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
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
Igor Chevdar
7dcdbf283b
[box-tests] Added test
2021-04-26 11:53:27 +05: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
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
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
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
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
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
Dmitry Petrov
531a0de399
JVM_IR KT-46060 'contains' operator without receiver is non-optimizable
2021-04-14 19:18:42 +03:00
Mark Punzalan
21a3a14289
FIR: Use intersection of all upper bounds for parameterized types in
...
ConeKotlinType.canBeNull.
^KT-45903 In progress
2021-04-14 19:17:10 +03:00
Ilmir Usmanov
74b1fdcc60
Minor. Add regression test
...
#KT-45991
2021-04-14 10:48:59 +02:00
Ilmir Usmanov
29c975fc43
Minor. Add regression test
...
#KT-45539 Obsolete
2021-04-14 10:48:57 +02:00
Ilmir Usmanov
19b1b48e87
Minor. Add tests to check returning inline class from default method
...
#KT-45539 Obsolete
2021-04-14 10:48:54 +02:00
Steven Schäfer
7a9ff15d73
JVM IR: Handle suspend interface default methods with generic types (KT-45166)
2021-04-13 23:04:32 +02:00
Dmitry Petrov
7d62f0b5aa
JVM_IR KT-45187 use Arrays.copyOf to copy an array in spread operator
...
Creating a new array (and copying data into it with System.arraycopy)
doesn't work in generic case, because the actual array class depends on
call site.
2021-04-13 22:27:37 +03:00
pyos
cc7187e49b
JVM_IR: cast argument of enumValueOf to String in bytecode
...
Generic functions and implicit casts may return a supertype instead.
#KT-45865 Fixed
2021-04-13 13:24:24 +02:00
Dmitry Petrov
f59b49db68
JVM_IR KT-45967 generate accessor for argument of indy intrinsic
...
TODO handle inaccessible constructors gracefully
2021-04-12 17:36:24 +03:00
Victor Petukhov
e8275d2527
Complete old inference's callable references properly, by updating descriptor, resolved call and recorded expression's type
...
^KT-45721 Fixed
^KT-44994 Fixed
2021-04-12 14:00:38 +03:00
Alexander Udalov
ea22f4b681
IR: check absence of extension receiver in isMethodOfAny
...
Otherwise extension methods named toString/equals/hashCode were
generated incorrectly on JVM IR, which could result in
AbstractMethodError at runtime.
#KT-45963 Fixed
2021-04-11 13:54:13 +02:00
Ilmir Usmanov
bce92d824a
Minor. Add tests to check returning Result from functions
...
Mainly, that virtual functions, returning Result, are mangled.
#KT-45855
2021-04-09 22:09:03 +03:00
Mads Ager
b27a109a1e
[JVM] Fix shrinking of local range for dead variables.
...
Coroutine transform would occasionally *extend* the range of a
local instead of shrinking it (if the next suspension point
is after the end point for the local). That leads to the local
variable table having a local that covers code where it is not
defined. That is invalid and leads to D8 removing the locals
table from the code.
2021-04-09 19:06:13 +03:00
Denis.Zharkov
bd05ef19de
Add blackbox test for definitely-not-null types
...
^KT-26245 Fixed
2021-04-09 13:06:32 +03:00
Dmitry Petrov
ed88aa43a4
JVM_IR KT-45868 look for parent for delegating lambda in scope stack
2021-04-08 23:49:59 +03:00
Nikolay Krasko
02e37dceeb
Regenerate LightAnalysisModeTestGenerated.java
2021-04-08 18:51:08 +03:00
Ilya Goncharov
b82c9225c8
[IR] Fix copying of default argument from expect to actual with type parameter
...
^KT-45866 fixed
2021-04-07 18:13:06 +03:00
Dmitry Petrov
120eba8d3d
Minor: add tests for KT-45893
2021-04-05 17:50:43 +03:00
Dmitry Petrov
19fb7ebfd5
JVM_IR fix local class names for files with @JvmPackageName
2021-04-02 00:08:55 +03:00
Ilmir Usmanov
b5ecccb610
Enable suspend in fun interfaces by default
...
#KT-45836 Fixed
2021-04-01 20:26:42 +03:00
Denis.Zharkov
d685e2aac7
FIR2IR: Fix inheritance case from built-in interface with default methods
2021-04-01 12:11:37 +03:00
Ilmir Usmanov
786999bcfe
Minor. Add regression tests
...
#KT-44143
2021-04-01 00:51:08 +03:00
Ilya Goncharov
47f1a8a0bb
[IR] Make IrTypeOperatorCall copyable
...
^KT-45655 fixed
2021-03-31 20:14:52 +03:00
Dmitry Petrov
9bf7f3af04
JVM_IR KT-45697 reference classes from sources before IR generation
2021-03-31 16:40:49 +03:00