Commit Graph

3670 Commits

Author SHA1 Message Date
Alexander Udalov 628d75c7cd JVM: fix EnclosingMethod information for SAMs in inline lambdas
Pass parentContext to SamWrapperCodegen from the outside instead of
using the one from parentCodegen. The difference is that in case of an
inline lambda, we're creating an InlineLambdaContext whose parent is a
ClosureContext, but the codegen for that lambda has that latter
ClosureContext as its context. So the getNonInlineOuterContext call in
SamWrapperCodegen.generateInnerClassInformation wasn't able to identify
that this is a context of a lambda that needs to be skipped, and
generated it as EnclosingMethod, which caused Java reflection to fail
because once that lambda was inlined, it was removed and thus didn't
make it to runtime.

 #KT-44827 Fixed
2021-03-09 11:43:11 +01:00
Mads Ager 7dbb0c7d20 [IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
2021-03-09 09:48:16 +03:00
Alexander Udalov 6ddca4a592 Add KClass.isValue to kotlin-reflect
#KT-44782 Fixed
2021-03-08 21:22:40 +01:00
Alexander Udalov 8b8262096c Fix testKt44814 by adding an IR dump
It's supposedly needed because of the `// DUMP_IR` directive.
2021-03-08 17:32:13 +01:00
Ilya Gorbunov 9cc8f44390 Support mod and floorDiv extensions in constant evaluator
Ignore evaluation tests for floorDiv and mod with FIR for now.
2021-03-05 23:46:57 +03:00
Ilya Gorbunov 58e6f775bb Rename test of rem operator evaluation 2021-03-05 23:46:57 +03:00
Mads Ager e5631addf3 [IR] Move annotations from original to new constructor declarations.
LocalDeclarationsLowering did not move annotations when creating
a new constructor declaration, thereby losing the annotations.

Fixes KT-45298
2021-03-05 12:24:38 -08:00
Mads Ager 965c118521 [JVM IR] Make upper bounds check recursive for ieee Equals.
Fixes KT-44402
2021-03-05 12:22:54 -08:00
Dmitriy Novozhilov aa829c2321 [FIR2IR] Fix using default values of annotation arguments 2021-03-05 13:00:12 +03:00
Dmitriy Novozhilov 8324f499cd [FIR] Fix serializing annotation metadata on setters value parameters 2021-03-05 13:00:11 +03:00
Dmitriy Novozhilov a6d1d47918 [FIR] Fix clearing info about DF variable after reassignment 2021-03-04 17:09:17 +03:00
Mads Ager 8e9dfc23b6 FIR: Take targeted annotations into account for metadata
Getter/setter targeted annotations were not correctly reflected
in the kotlin metadata which made them not work with
kotlin-reflect.
2021-03-03 08:48:28 +03:00
Dmitriy Novozhilov 714c2a8f93 [FIR] Bind return expression to function symbol instead of function itself 2021-03-02 19:11:27 +03:00
Dmitriy Novozhilov 245bc7c8e2 [FIR2IR] Fix interpreting constants from const properties from other module 2021-03-02 19:11:26 +03:00
Dmitriy Novozhilov a7e6667648 [FIR] Properly deserialize annotations of properties in interfaces 2021-03-02 19:11:24 +03:00
Dmitriy Novozhilov da0fd7cc15 [FIR2IR] Approximate non-denotable types when converting ConeType to IrType 2021-03-02 19:11:21 +03:00
Dmitriy Novozhilov af79265f42 [FIR] Fix creating overrides for functions with name same as renamed in JVM builtins 2021-03-02 19:11:15 +03:00
Mikhael Bogdanov 77559e8299 Temporary mute reflection test on Android 2021-03-01 18:05:27 +01:00
Mikhael Bogdanov 49aa36b70d Generate local delegated properties in interface in jvm-default all modes 2021-03-01 16:20:20 +01:00
Mikhael Bogdanov c25a694b6b Generate private suspend functions as private (not synthetic package-private)
#KT-26592 Fixed
2021-03-01 16:20:19 +01:00
Mikhael Bogdanov ad8eddac99 Add test for private suspend and JVM defaults 2021-03-01 16:20:19 +01:00
Mikhael Bogdanov 8764bb09f2 Generate synthetic annotation method in interface if -Xjvm-default is on 2021-03-01 16:20:19 +01:00
Stanislav Erokhin f77ba914c7 [MERGE] Kotlin/Native history merged into kotlin/master 2021-02-26 15:30:58 +01:00
Alexander Udalov 417eb60ed3 Revert "Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern."
This reverts commit 073a500370.

(cherry picked from commit eec98314c8)
2021-02-26 12:51:53 +01:00
Mikhail Glukhikh 2bf3abcb29 FIR: cache accessor symbols in JavaClassUseSiteMemberScope 2021-02-26 12:27:07 +03:00
Alexander Udalov acc2256de9 IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed
2021-02-25 21:00:09 +01:00
Victor Petukhov 94e6ec7dfd Fix test after 27846f4532 2021-02-25 22:29:45 +03:00
Denis.Zharkov 4fffe7b9c8 FIR: Fix VerifyError caused by private delegates
^KT-45048 Fixed
2021-02-25 19:30:15 +03:00
Victor Petukhov 27846f4532 Add tests for obsolete issues (KT-42722, KT-39880) 2021-02-25 15:30:29 +03:00
Dmitriy Novozhilov 4222bb9af2 [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 14:56:08 +03:00
Vasily Levchenko 0324ee508e [testData][compiler] disable tests KT4282{4,5} for native backend 2021-02-24 11:07:16 +01:00
Igor Chevdar 9d8abca195 [box-tests] Disabled a test for K/N 2021-02-24 11:00:27 +05:00
Mads Ager 8852323a76 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.
2021-02-23 19:33:49 +01:00
Ilmir Usmanov d44799fa78 JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:10 +01:00
Ilmir Usmanov 3ee62cb1b2 JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:06 +01:00
Alexander Udalov e6476c39ca JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed
2021-02-22 12:52:48 +01:00
Alexander Udalov eec98314c8 Revert "Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern."
This reverts commit 073a500370.
2021-02-22 10:14:32 +01:00
Pavel Punegov 073a500370 Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern. 2021-02-21 11:12:33 +03:00
Pavel Punegov 95a8c60a9c Ignore test in Native backend. Test overrides kotlin.Result 2021-02-21 11:11:46 +03:00
Pavel Punegov 4643f12a5f Ignore JVM test in Native backend 2021-02-21 11:11:46 +03:00
Dmitriy Novozhilov ea2783eace [FIR] Fix generating this reference in delegated accessors
There was a problem with delegated extension property with dispatch
  receiver that `this` in `getValue` call was set to dispatch receiver
  instead of extension one
2021-02-20 18:27:43 +03:00
Dmitry Petrov 387d84f826 JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 15:07:24 +03:00
Denis.Zharkov 1fe0a1f160 FIR: Fix interface delegation case via type alias 2021-02-20 10:59:23 +03:00
Denis.Zharkov e4c851e3ce FIR2IR: Fix case of @JvmOverloads with subclass
Avoid generating synthetic overrides in subclass
It has been already working for PSI2IR because fake overrides there don't
inherit default values for parameters, while they do it in FIR
2021-02-20 10:59:22 +03:00
Denis.Zharkov 377a0aa237 FIR2IR: Adjust test data for updated overridden structure 2021-02-20 10:59:22 +03:00
Denis.Zharkov a750d9466e FIR2IR: Rework resulted overridden-relation structure
The difference is how we deal with intermediate fake overrides
E.g., in case

interface A { /* $1 */ fun foo() }
interface B : A {
     /* $2 */ fake_override fun foo()
}
interface C : B {
   /* $3 */ override fun foo()
}

We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.

Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.

Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.

So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
2021-02-20 10:59:22 +03:00
Denis.Zharkov fd146e3eed FIR2IR: Copy annotations from original declarations to fake overrides 2021-02-20 10:59:22 +03:00
Mikhail Glukhikh 1a0be3ee40 Fix FirAnnotationArgumentChecker (String + ... case) #KT-44995 Fixed 2021-02-20 10:31:26 +03:00
Dmitriy Novozhilov 1c0d862e40 [FIR] Don't smartcast variables to invisible types
#KT-44802 Fixed
2021-02-20 10:23:33 +03:00
Mikhail Glukhikh 73616107b4 Unmute passing FIR BB test 2021-02-19 12:19:42 +03:00