Mads Ager
2c5a4dcb98
[JVM IR] Fix constant folding to use basic types always.
...
Fixes KT-46540.
2021-05-12 11:57:20 +02:00
pyos
d5d6736e67
PSI2IR/FIR2IR: do not approximate T!! before translation
...
This leads to weird effects when it's in a contravariant position,
because it's approximated by Nothing.
2021-05-12 11:37:48 +03:00
pyos
a37db99841
JVM_IR: remove a hack from InlineCallableReferenceToLambda
...
It breaks other things, the same problem is hit by FunctionReference,
and it's the translation layer's fault anyway.
#KT-46555 Fixed
2021-05-12 11:37:47 +03:00
pyos
cff74b31d4
JVM_IR: get unbound property reference receiver type from KProperty1
2021-05-12 11:37:45 +03:00
Mads Ager
d397efb2bd
[JVM IR] Copy attributes for JVM_STATIC_WRAPPERS.
2021-05-11 16:26:04 +02:00
Mads Ager
3db5ba98ad
[JVM IR] Do not insert Nothing handling in JvmStatic wrapper.
...
Fixes KT-46568.
2021-05-11 16:26:04 +02:00
Ilmir Usmanov
640d263ae1
Do not unbox nullable Result, since before usage it is coerced
...
#KT-46505
2021-05-11 05:49:24 +02:00
pyos
656c2496a6
JVM_IR: omit bound receiver in IrExpressionLambdaImpl parameters
...
and remove a hack intended to replace the missing type conversions this
caused.
#KT-46505 Fixed
2021-05-11 05:49:20 +02:00
Dmitry Petrov
ac0aaff611
JVM_IR KT-46562 don't use LambdaMetafactory for Serializable SAMs
...
TODO support serializable lambdas creation with LambdaMetafactory
2021-05-10 14:54:14 +03:00
Jinseong Jeon
bdfc879f00
FIR checker: report UNINITIALIZED_PARAMETER
2021-05-10 14:26:14 +03:00
Mikhael Bogdanov
cd7841ceed
Generate type annotations on class type parameters bounds
...
#KT-13228
#KT-46539 Fixed
2021-05-10 12:12:21 +03:00
Mikhael Bogdanov
cbe3c66156
Generate function type parameter annotations and type annotations on their bounds into bytecode
...
Generate type parameter annotation by default for `-Xjvm-target 1.8` and above
#KT-46539
#KT-13228
#KT-46545 Fixed
2021-05-10 12:12:18 +03:00
Alexander Udalov
d306d8a90e
JVM IR: cast indy-SAM receiver type from KFunctionN to FunctionN
...
#KT-46512 Fixed
2021-05-07 00:53:31 +03:00
Mads Ager
b6fa28ea81
[JVM_IR] Deal with inline-class arguments in large arity lambdas.
...
FunctionNVarargBridgeLowering checked the name of the method instead
of whether the method overrides an invoke method. That doesn't work
when the name of the function gets mangled because of inline class
arguments.
Fixed KT-45084.
2021-05-06 17:27:59 +02:00
pyos
1181854bd6
Add a couple more tests for array constructors and references
2021-05-06 18:25:56 +03:00
pyos
9f53d70109
JVM_IR: move ArrayConstructor below function reference phases
...
This allows taking function references to inline array constructors.
Also, redundant classes are no longer generated when function references
are passed as arguments to the array constructors.
#KT-46426 Fixed
2021-05-06 18:25:53 +03:00
Mads Ager
6d9f02cfc6
[JVM_IR] Fix range of locals in connection with finally blocks.
...
For code such as:
```
try {
var y = "y"
for (i in 0 until 1) {
return y
}
} finally {
println("finally")
}
```
The local variables `y` and `i` ended up covering the finally block as
well in the debugger.
This change splits the range of the locals so that they do
not cover the finally block.
This change does not change the inliner to do similar transformations,
so the range of locals is still wrong win finally blocks when inlined
into an inline function. Added a failing test to that effect.
2021-05-03 07:43:37 +02:00
Dmitry Petrov
83e3a702c5
JVM_IR KT-46408 properly map fake overrides in method handles
2021-04-30 22:24:02 +03:00
Mikhail Glukhikh
80a449862e
FIR: implement diagnostics for qualifier as stand-alone expression case
2021-04-30 17:59:45 +03:00
Mikhail Glukhikh
84ccf7bbb1
FIR: use Java 8 rules in not implemented checker
2021-04-30 17:59:38 +03:00
Victor Petukhov
7c62e9aecd
Introduce warnings reporting by missed constraints because of incorrect optimization in the constraints processor
2021-04-30 15:46:04 +03:00
Andrey Zinovyev
287ff3ed55
[FIR] Fix for AugmentedArraySetCall expression type
...
Hacky fix so it's type is Unit and not error
2021-04-30 15:25:44 +03:00
Dmitry Petrov
72804d2e8c
JVM_IR KT-45779 don't generate intrinsic method refs via invokedynamic
2021-04-30 12:45:11 +03:00
Andi Wenger
f9d2ca68ce
KJS IR: Fix KT-45738 - Consider recursive checkForPrimitiveOrPattern
...
Recursive results from checkForPrimitiveOrPattern were ignored. If it found a case/condition that could not be optimized the resulting "false" was not propagated. This would lead to a "optimized" when without all conditions.
- see KT-45738
- The return is now lifted out of the when to make it more obvious what is going on.
- New test for mixed multiple conditions in when
2021-04-29 23:52:01 +03:00
Ilmir Usmanov
cb89bd0e13
Generate SuspendFunction marker interface if supertype is suspend
...
Otherwise, is/as checks will not work.
#KT-18707
2021-04-29 17:11:31 +03:00
Steven Schäfer
84d78035e4
JVM IR: Avoid double mangling of function reference invoke methods
2021-04-29 13:10:43 +02:00
Alexander Udalov
276ffd5a4b
JVM IR: fix ::class reference and type mapping for scripts
...
#KT-46284 Fixed
2021-04-29 00:33:34 +03:00
Dmitriy Novozhilov
07b15f9de6
[FIR] Support effective visibility with @PublishedApi
...
#KT-46270 Fixed
2021-04-27 18:39:10 +03:00
Dmitriy Novozhilov
32c3f85679
[FIR] Add inline checker for bodies of inline functions
...
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it
were muted. #KT-46270
2021-04-27 18:39:09 +03:00
Ilmir Usmanov
0c0710bb79
Fix outer class accesses inside suspendImpl functions
...
We need to generate this$0 fields to get to the outer class and generate
accesses to these fields inside suspendImpl function.
#KT-46214 Fixed
2021-04-27 10:44:18 +02:00
Ilmir Usmanov
dc2485ae71
Support suspend functions as superinterfaces
...
Forbid mixing suspend and non-suspend functional supertypes.
Since JVM BE generates suspend functional types as non-suspend ones
with SuspendFunction marker interface, there is not way to distinguish
non-suspend functional type from suspend one if they are mixed.
#KT-18707 Fixed
2021-04-26 22:14:32 +02:00
Steven Schäfer
a1c1a32515
JVM: Fix unsigned literals in API version < 1.5
2021-04-26 15:11:45 +03:00
Mark Punzalan
9a4742c08d
FIR: Properly build nullable suspend function types, and aggregate
...
modifiers and annotations within KtTypeReference/REFERENCE_TYPE nodes.
2021-04-26 15:11:38 +03:00
Mikhail Glukhikh
f278de8768
FIR: don't call toString() inside string concatenations
2021-04-26 12:50:55 +03:00
Igor Chevdar
7dcdbf283b
[box-tests] Added test
2021-04-26 11:53:27 +05:00
Alexander Udalov
0c3f2eefe0
Migrate bytecodeListing tests to new test infrastructure
2021-04-23 17:58:16 +02:00
Ilmir Usmanov
f7a9bc3521
Minor. Make test actually suspend and add a test without suspension
2021-04-23 03:50:08 +02:00
pyos
23ffbe4d9e
JVM_IR: do not box inline classes in suspend multifile bridges
2021-04-23 03:49:47 +02:00
pyos
7d95943b8b
JVM_IR: do not box inline classes in suspend synthetic accessors
2021-04-23 03:49:43 +02:00
Alexander Udalov
b2005302dc
JVM, JVM IR: erase generic SAM supertypes
...
Also, do not try to use invokedynamic on SAM calls with intersection
types, because intersection type is not allowed as an immediate type
projection of a supertype, and constructing a fake override in
LambdaMetafactoryArgumentsBuilder led to an exception. This fixes the
problem which was worked around earlier in e6c089ef , effectively
reverting that commit.
The main motivation for this change is that LambdaMetafactory also
doesn't generate generic signature for SAM wrapper classes at runtime.
Since these classes are synthetic, nobody should rely on the fact that
they have generic supertypes, which was observable only via Java
reflection.
#KT-46149 Fixed
#KT-46238 Fixed
2021-04-22 10:53:15 +02:00
Dmitry Petrov
5324cbe729
Minor: update tests
2021-04-21 19:10:32 +03:00
Steven Schäfer
d3d4e94cd6
JVM: Fix constant folding for unsigned values
2021-04-21 19:10:31 +03:00
Dmitry Petrov
732405895f
Add tests for KT-45308
2021-04-21 17:36:12 +03:00
Dmitry Petrov
f228c3bb04
Add tests for KT-45236
2021-04-21 17:24:41 +03:00
pyos
e6d923f65c
FIR: rename HIDDEN to INVISIBLE_REFERENCE
...
Some of them should be INVISIBLE_MEMBER though
2021-04-21 16:18:21 +03:00
Alexander Udalov
7fe10e27a1
Minor, fix failing codegen tests on different JDKs
...
#KT-46238
2021-04-21 14:43:10 +02:00
Dmitry Petrov
59de12c609
Minor: mute bytecode text check in some box tests failing in FIR
2021-04-21 11:27:12 +03:00
Dmitry Petrov
f519150c08
JVM_IR KT-46189 lower tailrec functions after local declarations
2021-04-21 11:27:11 +03:00
Alexander Udalov
21e9bd7ea2
Add regression tests for obsolete issues
...
#KT-9304
#KT-14961
#KT-16549
#KT-21080
#KT-28234
#KT-30102
#KT-31994
#KT-34291
#KT-38099
#KT-41174
#KT-44622
#KT-44701
#KT-44781
#KT-44849
#KT-44978
#KT-45081
#KT-45286
#KT-45383
#KT-45444
#KT-45907
2021-04-20 21:24:29 +02:00
Alexander Udalov
e6c089ef40
IR: fix SAM conversion for types with contravariant intersection argument type
...
In the added test, the problem was that the SAM type as computed by
`SamTypeFactory.createByValueParameter` was `Consumer<{BaseClass &
BaseInterface}>`, which was latter approximated in psi2ir during the
KotlinType->IrType conversion to `Consumer<out Any?>` (here:
https://github.com/JetBrains/kotlin/blob/3034d9d791cf1f9033104e12448e0d262d3bc3ce/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt#L606 ),
because intersection type argument is approximated to `out Any?`.
To avoid this, replace intersection type in immediate arguments of a SAM
type with the common supertype of its components at the same place where
we're getting rid of projections.
#KT-45945 Fixed
2021-04-20 17:31:14 +02:00