Commit Graph

2973 Commits

Author SHA1 Message Date
Alexander Udalov 82551e91a4 Add KClass.isFun modifier to reflection
#KT-38881 Fixed
2020-05-14 14:05:51 +02:00
Anton Bannykh 86b5c63891 JS IR: fix origin for callable references with bound reciever
In case of IrFunctionReference with type SuspendFunction (no K!) there
was a misalignment between the base class (Any) and the
origin (LAMBDA..). As a result the SuspendFunctionLowering was
getting confused and produced hanging code.
2020-05-14 14:33:12 +03:00
Anton Bannykh bdca4b45bd JS: inliner supports extra argument caused by suspend conversions 2020-05-14 14:33:12 +03:00
Mikhail Glukhikh cdac6157a9 [FIR2IR] Force loading Java SAM from external classes 2020-05-14 14:07:40 +03:00
Juan Chen 858731cac8 [FIR] add support for varargs in delegated constructor calls
Also add support for spread operators as named arguments.
2020-05-14 13:42:07 +03:00
Mikhail Glukhikh 3652ac9354 [FIR2IR] Mute 2 failing BB tests
Looks like both tests are failing because now only classes from
'kotlin.*' are considered "external" and generated with declarations.
2020-05-14 13:40:37 +03:00
Mikhail Glukhikh e7e80be34a [FIR2IR] Populate overridden symbols even for !isOverride
Before this commit we considered !isOverride as a sign that
function / field / accessor has no overridden symbols.
However, it's false for deserialized, because isOverride
is always false there.

This commit fixes 68 BB tests but breaks 25 BB tests (not yet muted)
2020-05-14 13:40:36 +03:00
Jinseong Jeon 931ba4892a FIR2IR: split property annotations according to use-site targets. 2020-05-14 09:41:11 +03:00
Steven Schäfer 497df0922a JVM IR: Fix corresponding properties in inline classes 2020-05-13 20:57:52 +02:00
pyos 8809abdbac JVM_IR: do not handle Nothing in suspend tail call bridges
Else they wouldn't be tail call, would they?
2020-05-13 05:54:37 -07:00
Ilmir Usmanov 0acaedef92 Fix attribute clash between STATIC_INLINE_CLASS_REPLACEMENT and original
Attributes are used to name continuation classes and are generated
before inline classes processing. During the processing, for override
functions in inlined classes, the compiler generates
STATIC_INLINE_CLASS_REPLACEMENT function with body of the override.
The override's body is replaced with delegating call to
STATIC_INLINE_CLASS_REPLACEMENT. However, since we need to keep the name
of the continuation class, we copy attributes from the override to
STATIC_INLINE_CLASS_REPLACEMENT. This leads to attribute clash during
AddContinuationLowering.
So, to fix the issue, do not use the attribute of
STATIC_INLINE_CLASS_REPLACEMENT in original->suspend map.
As an optimization, do not generate continuation for the override
function.
2020-05-13 14:53:37 +02:00
Alexander Udalov d2a691d157 Minor, ignore failing box tests for light analysis 2020-05-13 13:54:51 +02:00
Mark Punzalan b5b361bb09 Add tests for nullable loop variable in for-loop over unsigned progression. 2020-05-13 13:54:35 +02:00
Mark Punzalan eaddd02e9b Mute/unmute failing/passing unsigned progression tests for FIR. 2020-05-13 13:54:35 +02:00
Mark Punzalan 0e6af517d7 Generate tests for unsigned progressions using
GenerateSteppedRangesCodegenTestData.
2020-05-13 13:54:35 +02:00
Jinseong Jeon 6034fcdc46 FIR2IR: apply SAM conversion to arguments if needed 2020-05-13 11:28:48 +03:00
Alexander Udalov 0ce16b9d8c Support non-reified type parameters in typeOf in JVM and JVM_IR
#KT-30279 Fixed
2020-05-13 10:04:28 +02:00
Mikhael Bogdanov 5ef37148ea Add flag for proper array convention with default args calls 2020-05-13 08:51:57 +02:00
Mikhail Bogdanov adc770b604 Process default arguments in array convention calls
#KT-16520 Fixed
2020-05-13 08:51:57 +02:00
Jinseong Jeon 30e5748fec FIR: set proper visibility of property accessors. 2020-05-12 19:47:37 +03:00
Mikhail Glukhikh 28c0dac36f [FIR] Set FirJavaClass.isInner properly 2020-05-12 16:57:07 +03:00
Mikhail Glukhikh 457fb09e3a [FIR] Use tower to resolve delegated constructors, set dispatch receiver 2020-05-12 16:57:07 +03:00
Jinseong Jeon fd584e6f13 FIR2IR: fix offsets for calls. 2020-05-09 21:11:40 +03:00
Jinseong Jeon eac9af521e [FIR2IR] differentiate external Java stub origin from external stub 2020-05-08 17:45:39 +03:00
Mikhail Glukhikh b271b6d7a8 [FIR2IR] Add conversion of value parameter annotations 2020-05-08 17:30:28 +03:00
Mikhail Glukhikh 76f6e27e37 [FIR2IR] Add initial support of collection literals 2020-05-08 17:30:24 +03:00
Mikhail Glukhikh f3e2dbf360 [FIR2IR] Add conversion of function annotations 2020-05-08 17:30:19 +03:00
Alexander Udalov 91ef053fbc IR: keep local scope with counter maps across LDL invocations
Since LocalDeclarationsLowering is a BodyLoweringPass, local
functions inside one declaration are handled independently of local
functions in the other declaration. This can lead to name clashes, in
case a local function with the same name and signature is declared in
overloads in the same container, which results in a signature clash
error in JVM IR.

The issue became more common with the introduction of adapted function
references, where psi2ir generates a local adapter-function with a
predefined name, which can easily clash with another reference to the
same target in an overload. This led to a compilation error when
bootstrapping Kotlin with JVM IR, for example in GradleIRBuilder.kt
where there are a lot of references to the same function.
2020-05-08 14:33:34 +02:00
Mikhail Glukhikh d8f9643650 [FIR2IR] Use intersection type approximation for receivers 2020-05-07 15:27:17 +03:00
Steven Schäfer 821aca984b JVM IR: Take superQualifierSymbols into account when lowering inline classes 2020-05-07 11:44:09 +02:00
Mikhail Glukhikh 38fc4d0f1f FIR: set & use dispatch receiver for q. access with super reference 2020-05-07 12:02:57 +03:00
Jinseong Jeon 7b01cf7b04 FIR: handle labeled super reference properly 2020-05-07 12:02:56 +03:00
Jinseong Jeon 0c7ed04260 FIR: make (K)SuspendFunctionX derived from (K)Function 2020-05-06 13:09:32 +03:00
Alexander Udalov 54f9f130e2 Do not generate references as adapted with -Xno-optimized-callable-references
The reason for this is that this flag is used right now in 'cli-common'
to workaround the problem that this module is compiled with API version
1.4, but runs with stdlib of version 1.3 (bundled to Gradle). The same
problem would appear with adapted function references, since we use
kotlin/jvm/internal/AdaptedFunctionReference in the bytecode, only
available since 1.4.

The fix is to generate adapted references in this case as subclasses of
the already existing kotlin/jvm/internal/FunctionReference. This can
change behavior in some extreme corner cases (because such references
can now be observed to have reflection capabilities), but it's an -X
argument anyway.

Another option would be to introduce another compiler argument
specifically for this, but it looks like it would only complicate things
without much benefit.
2020-05-04 13:24:53 +02:00
Dmitry Petrov a564d47158 Minor: unmute FIR black box test
Guys, please, can you do it yourself?
2020-05-01 13:14:21 +03:00
Mikhail Glukhikh 87393398f2 FIR serializer: fix isLambda copying 2020-04-30 13:54:27 +03:00
simon.ogorodnik 6ca3a994d9 [FIR2IR] Disable initializer generation for external enum entries 2020-04-30 13:31:12 +03:00
simon.ogorodnik a11866ab5a [FIR2IR] Fix labeled this references 2020-04-30 13:15:43 +03:00
Jinseong Jeon 9a561f4a7c FIR2IR: generate synthetic members for inline class 2020-04-30 13:09:53 +03:00
simon.ogorodnik ef8bcceb8e [FIR2IR] Use only data class primary constructor parameters for equals 2020-04-30 13:03:30 +03:00
Jinseong Jeon 0890b8bad3 FIR2IR: set superQualifierSymbol for property access 2020-04-30 12:26:47 +03:00
Jinseong Jeon a084c5bf7d FIR2IR: populate overriddenSymbols for overriding properties 2020-04-30 12:25:48 +03:00
pyos df4f1365ec PSI2IR: support SAM conversion to substituted types
i.e. in arguments to `f(T x)` where `T` is a type parameter bound to a
SAM type.
2020-04-29 18:50:40 +03:00
Dmitry Petrov d9fd51c608 JVM_IR: basic suspend conversion on argument test passed 2020-04-29 18:28:05 +03:00
Mikhail Zarechenskiy 780bc1f607 Fix fun interfaces with extension receivers
#KT-37712 Fixed
2020-04-29 14:15:25 +03:00
Mikhail Zarechenskiy fa50d66afe [NI] Fix SAM conversion for projected-out members
#KT-25290 Fixed
2020-04-29 14:15:25 +03:00
Alexander Udalov 9fa8e009c6 Support equals/hashCode for fun interfaces in JVM and JVM_IR
#KT-33455 Fixed
2020-04-29 12:15:50 +02:00
Ilya Chernikov 4a0d1b0b9d Use precalculated intersection type in JVM backend
also test all backends for the problem in the issue
#KT-37715 fixed
2020-04-29 11:12:22 +02:00
Dmitry Petrov f9bb07e128 JVM_IR: generate flags for adapted function references 2020-04-29 00:55:52 +03:00
Steven Schäfer 905a8ca0d0 Reflect: Handle methods with inline class default parameters 2020-04-28 19:49:35 +02:00