Commit Graph

22 Commits

Author SHA1 Message Date
Alexander Udalov 55974b4eda JVM IR: do not generate InlineOnly property accessors in multifile facade
#KT-37007 Fixed
2020-11-06 19:27:53 +01:00
Alexander Udalov b257b03152 JVM IR: do not generate JvmName on multifile parts
#KT-36970 Fixed
2020-10-13 16:40:52 +02:00
Alexander Udalov c46c80822c JVM IR: fix enclosing constructor for lambdas in inner classes
Before this change, we stored the enclosing constructor in a map in
JvmBackendContext before moving lambdas and local classes out of
initializer blocks. However, in case the lambda was declared in an inner
class, we stored a reference to the unlowered constructor of the inner
class, whose JVM signature is "()V" instead of the correct "(LOuter;)V".
Java reflection then threw exception if we tried to call
`getEnclosingConstructor()` on such class at runtime. Proguard finished
with errors for the same reason.

It turns out that we can just store the fact that the class has been
moved, and load the matching constructor in codegen, where everything is
already lowered and guaranteed to match with the signatures of the
actual generated declarations.

 #KT-41668 Fixed
2020-09-08 23:37:00 +02:00
Alexander Udalov 228e329d1f JVM IR: generate enclosing constructor only for lambdas in initializers
There was a typo in JvmLocalClassPopupLowering which allowed the
EnclosingMethod for lambdas and anonymous classes in initializers to
become any function in a class, in case when there was no primary
constructor in that class. E.g. in the added test, `getIrrelevantField`
was the EnclosingMethod of the lambda class before this change.
2020-09-08 23:37:00 +02:00
Alexander Udalov 0dea6b94c6 JVM IR: unmute boxInline tests on enclosing method/class
In box tests, only check that Java reflection does not crash on the
EnclosingMethod attribute generated in these classes. If it doesn't
crash, most likely it returns the value that can be read from the class
file by ASM, which is what the newly added bytecode listing tests are
checking now.
2020-09-07 19:41:37 +02:00
Dmitry Petrov 89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitry Petrov eefa621c56 JVM_IR KT-37006: InlineOnly property accessors are private in bytecode 2020-06-29 19:08:58 +03:00
Dmitry Petrov 2137a4b1e5 JVM, JVM_IR: no nullability annotations on private and synthetic methods
NB it looks like it doesn't cover all cases, e.g., some synthetic
methods generated for suspend functions.
2020-06-26 18:51:35 +03:00
Ilmir Usmanov 354fb3c4ba JVM_IR: Generate fake continuations and their constructors as public
#KT-37093 Fixed
2020-03-04 21:32:35 +01:00
Ilmir Usmanov 4b4a6101c1 JVM_IR: Generate inline functions with reified generics as public synthetic
Otherwise, proguard will remove them.
 #KT-37004 Fixed
2020-03-04 21:32:31 +01:00
Ilmir Usmanov 5826db97c7 JVM_IR: Do not duplicate inline suspend functions with reified type parameters
They are inline-only.
Generate $$forInline versions of inline suspend functions as private.
This way, there is no nullability annotation on there parameters and return
values. Unfortunately, old BE does generate them.
 #KT-37088 Fixed
2020-03-04 21:32:27 +01:00
Mark Punzalan b782e8f0f0 Add IR equivalent of AbstractBytecodeListingTest and muted failures. 2020-02-13 23:44:53 +03:00
Alexander Udalov e2a42446ed Use getter names for $annotations methods in most codegen tests
This is needed to update master to 1.4, while still testing the latest
compiler by default. Also add one test on the old behavior.
2019-12-30 16:29:13 +01:00
Ilya Chernikov f38bb19fc6 [minor] Fix testdata for compiler 1.4 2019-12-19 14:01:01 +01:00
Alexander Udalov 01ddac58e1 Add language feature for changed name of property annotations method
#KT-31352 Fixed
2019-08-12 16:48:26 +02:00
Alexander Udalov ea0142da60 Use JVM name of getter in synthetic method for property annotations
#KT-31352 In Progress
2019-08-12 16:48:25 +02:00
Alexander Udalov f9d61f2dc7 Make inline+reified functions synthetic instead of private in bytecode
#KT-18563 Fixed
2019-05-28 16:17:49 +02:00
Alexander Udalov b42adcd73d Restructure bytecode listing tests on InlineOnly/inline+reified 2019-05-28 15:56:15 +02:00
Ilmir Usmanov 266976ac1e Fix Java interop of inline suspend functions with suspend parameters
In 1.3.31 I fixed Java interop for inline function with coroutines
(TL;DR: when we need a state machine, generate two methods: one with
normal name, and the other one with $$forInline suffix, for the inliner
to use, just like inline suspend functions), however, I forgot a case
with inline suspend function with inline suspend function parameter.
In this case, the compiler a generated two functions, as needed, but,
neither of them had a state-machine. This change adds the state-machine
for the method with normal name. Note, that suspend inline functions
with crossinline parameter, which are also supported by the change,
did not cause incorrect behaviour, since until now they were generated
as synthetic.

 #KT-31354 Fixed
2019-05-21 17:50:25 +03:00
Ilmir Usmanov 2d04acba42 Update test data of compiler tests, except IR tests 2018-08-30 16:24:41 +03:00
Ilmir Usmanov de7aa23119 Make private inline suspend functions effectively inline-only 2018-06-13 15:08:26 +03:00
Ilmir Usmanov 8a5ae16947 Generate separate methods for inline and noinline uses of inline suspend functions
Previously, inline suspend functions were effectively inline only,
but ordinary inline functions can be used as noinline.
To fix the issue, I generate two functions: one for inline with suffix
$$forInline and without state machine; and the other one without any
suffix and state machine for direct calls.
This change does not affect effectively inline only suspend functions,
i.e. functions with reified generics, annotated with @InlineOnly
annotation and functions with crossinline parameters.
 #KT-20219: Fixed
2018-06-13 15:08:19 +03:00