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
Andrey Zinovyev
27766c2575
[FIR] Consistent isLocal for objects inside Enum entries
2021-04-20 18:12:51 +03:00
Alexander Udalov
4fffed4165
Improve test on equals/hashCode for KProperty accessors
...
Remove duplication & unnecessary checks, check equality in both
directions, check hashCode, add more cases, rename variables for
clarity.
#KT-13490
2021-04-19 20:39:54 +02:00
Xin Wang
c959b271a4
Override "hashCode" and "equals" for Getter and Setter to fix KT-13490
2021-04-19 20:39:54 +02:00
Dmitry Petrov
46d5e974df
JVM_IR KT-46160 don't use LambdaMetafactory for mutifile class members
2021-04-19 19:32:34 +03:00
pyos
dab693b075
Revert "JVM IR: Implement CHECK_NOT_NULL as a lowering"
...
This reverts commit dcd72b06d8 .
Using a temporary variable has an effect on casts and GC.
2021-04-19 16:05:12 +02:00
Dmitry Petrov
7f4da93cc3
JVM_IR KT-45998 protected companion object member accessors with indy
2021-04-19 15:41:21 +03:00
Dmitry Petrov
9a4a39e680
JVM_IR KT-45998 fix protected companion object member accessors
...
Also, make sure it works with indy-based SAM conversions.
2021-04-19 15:41:19 +03:00
Dmitry Petrov
cc415f62b5
JVM_IR KT-46092 fix array spread operator in Kotlin->Java call
2021-04-15 17:11:21 +03:00
Mikhail Glukhikh
9b3f1b9b8a
Inference: handle Exact constraints with captured types properly
...
#KT-41818 Fixed
2021-04-15 15:55:41 +03:00
Ilya Kirillov
0cf00d0f72
FIR: fix FirDefaultPropertyAccessor phase to BODY_RESOLVE
2021-04-15 15:23:56 +03:00
pyos
354acc1fd5
FIR: permit * as FunctionN type argument
...
`() -> *` is not valid, but `F<*>` where `typealias F<T> = () -> T` is.
2021-04-15 14:59:27 +03:00
Denis.Zharkov
32dacc37c0
FIR: Fix OverloadResolutionByLambdaReturnType case
2021-04-15 14:48:20 +03:00
Ilmir Usmanov
1c48fb28db
Generate return when generating continuation class for expression body
...
Otherwise, the function will return Unit instead of correct value.
#KT-46007 Fixed
2021-04-15 13:54:45 +03:00