Commit Graph

8267 Commits

Author SHA1 Message Date
Evgeniy.Zhelenskiy d4969e9b97 Revert "rra/zhelenskiy/flattening_impl"
This reverts commit b7f5c039a6.
2022-10-07 12:43:36 +00:00
Evgeniy.Zhelenskiy dff949344d [IR] Remove unused MFVC getters
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:42:15 +00:00
Evgeniy.Zhelenskiy 5c0784fef5 [IR] Add context receivers test, fix a flattening fields bug
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:42:14 +00:00
Evgeniy.Zhelenskiy afe67f9bc1 [IR] Support try for MFVC
#KT-1179
2022-10-07 12:42:14 +00:00
Evgeniy.Zhelenskiy ca789607ba [IR] Support if and when for MFVC, fix several bugs, refactor
#KT-1179
2022-10-07 12:42:13 +00:00
Evgeniy.Zhelenskiy e76041bb3b [IR] Rename MFVC tests + Add test for get-field optimization
#KT-1179
2022-10-07 12:42:12 +00:00
Evgeniy.Zhelenskiy 2c50fef251 [IR] Suppress temporary test failing on Android
Bug is fixed in https://jetbrains.team/p/kt/reviews/6452

#KT-1179
2022-10-07 12:42:12 +00:00
Evgeniy.Zhelenskiy c2284d15a5 [IR] Correct work of the new MFVC lowering classes
#KT-1179
2022-10-07 12:42:11 +00:00
Evgeniy.Zhelenskiy 5ea1edf6d1 [IR] Prepare MFVC-lowering for the new MFVC classes
#KT-1179
2022-10-07 12:42:10 +00:00
Evgeniy.Zhelenskiy d0590e4e83 [IR] Fix MFVC with type arguments/parameters
#KT-1179
2022-10-07 12:42:10 +00:00
Evgeniy.Zhelenskiy cd432b1371 [IR] Support MFVC with type parameters
#KT-1179
2022-10-07 12:42:09 +00:00
Evgeniy.Zhelenskiy b1dced6cda [IR] Integrate MFVC with Inline classes
#KT-1179
2022-10-07 12:42:08 +00:00
Evgeniy.Zhelenskiy a788433aac [IR] Add MFVC generation tests
#KT-1179
2022-10-07 12:42:07 +00:00
Evgeniy.Zhelenskiy 73b0fac657 [IR] Implement equals call correct generation for MFVC
#KT-1179
2022-10-07 12:42:07 +00:00
Evgeniy.Zhelenskiy ee2d327243 [IR] Implement bridges generation for MFVC
#KT-1179
2022-10-07 12:42:06 +00:00
Evgeniy.Zhelenskiy 2896f5613d [IR] Implement MFVC basic flattening
#KT-1179
2022-10-07 12:42:06 +00:00
Evgeniy.Zhelenskiy 93ffd9f233 Revert "rra/zhelenskiy/flattening_impl"
This reverts commit b7f5c039a6.
2022-10-07 12:42:05 +00:00
Alexander Udalov 4dcf50d483 Fix reflection for repeated annotations with array arguments
This is related to 8308f5d7d3 (KT-44977).

It turns out that it's necessary to create `ArrayValue` with a
precomputed type not only in case of annotations stored directly in
Kotlin metadata (i.e. annotations on types and type parameters), but
also for arguments of repeated annotations. The reason is that repeated
annotations are stored in an array themselves, as an argument to another
(container) annotation. The annotation-reading code unwraps this array
to load repeated annotations as individual instances of
`AnnotationDescriptor`, but in contrast to loading normal annotations,
it doesn't set `source` to the reflection object, it uses `NO_SOURCE`
(see BinaryClassAnnotationAndConstantLoaderImpl.AbstractAnnotationArgumentVisitor.visitArray).

So when kotlin-reflect is later asked for the arguments of the
annotation, it needs to recreate the reflection object from
`AnnotationDescriptor` in `util.kt`. Doing so requires knowing the array
type, which is now present because we're creating a `TypedArrayValue`
(previously `DeserializedArrayValue`) in places where arrays are read as
annotation arguments.

Alternative solution would be to fix source passed to
`AnnotationDescriptorImpl` in the annotation-reading code, but that
seems a bit messy because the code is very abstract and is used in lots
of other places.

 #KT-53279 Fixed
2022-10-07 10:48:51 +00:00
Alexander Udalov 51ce829b96 Fix reflection class lookup in default package
Do not append "." to the name of the class in the default package.
2022-10-07 10:48:51 +00:00
Evgeniy.Zhelenskiy b7f5c039a6 rra/zhelenskiy/flattening_impl
[IR] Remove unused MFVC getters

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Add context receivers test, fix a flattening fields bug

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Support `try` for MFVC

#KT-1179

[IR] Support `if` and `when` for MFVC, fix several bugs, refactor

#KT-1179

[IR] Rename MFVC tests + Add test for get-field optimization

#KT-1179

[IR] Suppress temporary test failing on Android

Bug is fixed in https://jetbrains.team/p/kt/reviews/6452

#KT-1179

[IR] Document the new MFVC lowering classes when necessary

#KT-1179

[IR] Correct work of the new MFVC lowering classes

#KT-1179

[IR] Prepare MFVC-lowering for the new MFVC classes

#KT-1179

[IR] Fix MFVC with type arguments/parameters

#KT-1179

[IR] Support MFVC with type parameters

#KT-1179

[IR] Integrate MFVC with Inline classes

#KT-1179

[IR] Fix compilation of MFVC in different module

#KT-1179

[IR] Add MFVC generation tests

#KT-1179

[IR] Implement equals call correct generation for MFVC

#KT-1179

[IR] Implement bridges generation for MFVC

#KT-1179

[IR] Implement MFVC basic flattening

#KT-1179

Merge-request: KT-MR-6213
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
2022-10-06 20:45:45 +00:00
pyos 8d33de4297 JVM: partially reify typeOf and signatures as soon as possible
E.g. when substituting T -> Array<T>, write the bytecode for the
Array<...> part for typeOf.

This fixes various issues where either Array nesting levels, nullability
information (for typeOf), or entire reification markers were missing,
causing incorrect outputs ranging from missing `?`s to missing `[]`s to
just reified types not really being reified.

^KT-53761 Fixed
2022-10-06 00:58:25 +02:00
Leonid Startsev ccdb6fc599 Fix .equals for instantiated annotations with unsigned array types.
#KT-53876 Fixed
2022-10-03 13:54:06 +00:00
Dmitriy Novozhilov 6623456d2a [FIR] Properly support @JvmRecord
^KT-53867 Fixed
2022-10-03 15:48:17 +03:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Artem Kobzar eb2326eabb [K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore. 2022-10-03 11:07:25 +00:00
Pavel Kunyavskiy ea3713f051 Fix building fake overrides for sam and function references 2022-09-30 08:48:59 +00:00
Pavel Kunyavskiy 2d4c94a115 [K/N] Add test for inter-module suspend function override 2022-09-30 08:48:59 +00:00
Mikhail Glukhikh 1ad2ec302b FirOverrideChecker: don't report VIRTUAL_MEMBER_HIDDEN with invisible
#KT-53197 Fixed
2022-09-29 08:34:12 +00:00
Pavel Mikhailovskii 903a5d69a4 KT-53146 Don't coerce Nothing? returned from "catch" clauses
At first, I tried to modify the logic in PromisedValue.materializeAt
to get rid of all casts from Nothing? to other types, but that broke
a number of tests containing casts of java.lang.Void to other types,
so I decided to fix only this particular case with try...catch
(for some reason, here we get a null of type java.lang.Object).
2022-09-29 06:15:39 +00:00
Alexander Udalov 4baa74f396 Add regression tests for obsolete issues
#KT-50909
 #KT-50974
 #KT-51888
2022-09-28 23:18:59 +02:00
Pavel Mikhailovskii 1b8a60b5a5 KT-51282 Add tests 2022-09-27 12:17:19 +00:00
pyos 2dd49e5fb4 JVM_IR: unwrap suspend views when generating SAM wrappers
If the super class is in a file that has already been lowered, the base
method has an extra continuation parameter which breaks things.

Also, SAM wrappers around functional objects are tail-call and do not
need continuations ever, so don't even try.

^KT-50950 Fixed
2022-09-23 21:55:00 +02:00
Alexander Udalov ba150ca370 Add JVM target bytecode version 19
Test data in `box/annotations/typeAnnotations` is changed because nested
classes in type annotations are rendered differently in JDK 19
(`Outer.Nested` instead of `Outer$Nested`).

 #KT-54116 Fixed
2022-09-22 21:56:10 +02:00
Ilmir Usmanov 3ee09f05ef JVM: Check for multiple {POP, Unit} sequences in suspend function TCO
We already check for {POP, Unit} sequence before ARETURN, but if the
there are multiple sequence before ARETURN, the compiler assumes, that
TCO misses.

The fix is to check, that the instruction after the sequence is either
ARETURN or another {POP, Unit} sequence.

 #KT-50835
 #KT-54152 Fixed
2022-09-22 19:46:52 +02:00
Pavel Mikhailovskii f8fd23e373 KT-8575 Add tests and disable reflection for Java synthetic property references 2022-09-22 13:33:28 +00:00
Igor Yakovlev 081cd4a4a8 [WASM] Support nullable types for external functions 2022-09-22 11:54:04 +02:00
Ilmir Usmanov 569e72c34e Minor. Do not check for specific bytecode in test 2022-09-21 16:42:15 +00:00
Xin Wang 0eadf35132 Inline: Fix operand stack type verify error
This is a proposal to fix KT-49364.
Operand stack type verification happens before `checkcast`
is executed. When we implicitly cast an inline class
to a non-inline type, if type of stack value is not subtype
of the target, then coercing is necessary.
2022-09-21 16:42:14 +00:00
Artem Kobzar 73e7053c35 [K/JS] Use only single variant of default arguments function wrapper for exported and not-exported functions 2022-09-19 17:49:04 +00:00
Mads Ager b7a7fce34e Add suspend lambda annotations to invokeSuspend.
For non-suspend lambdas annotations are carried over to the
invoke method so that tooling can find the annotation there.
It seems reasonable that annotations are carried over to
the invokeSuspend method on suspend lambdas as well so that
similar tooling can be built and work for suspend lambdas.
2022-09-16 23:21:18 +02:00
Igor Yakovlev 38dd68f1f4 [WASM] Enable passing tests 2022-09-15 16:27:46 +00:00
Igor Yakovlev 61d6f69bca [WASM] Native support of returnable blocks 2022-09-15 16:27:41 +00:00
Mikhail Glukhikh 036f9affd8 K2: link via signatures if -Xlink-via-signatures is set
Related to KT-53505
2022-09-14 10:15:22 +00:00
pyos acce055fc4 FIR: fix incorrect handling of suspend function typealiases again
The previous attempt stopped this code from throwing an exception during
serialization, but the arity is still wrong so an exception is now throw
when reading the serialized type.

^KT-50997 Fixed
2022-09-12 17:45:40 +02:00
Mikhail Glukhikh a742c126c2 FIR2IR: check for @JvmStatic also on property accessors 2022-09-07 17:05:13 +00:00
Pavel Mikhailovskii 0b453ee328 KT-41670 Check for default property accessors in SAM interfaces 2022-09-07 13:37:38 +00:00
Pavel Mikhailovskii a75d5ba4cf KT-53465, KT-53677 Get rid of unnecessary checkcasts to array of reified type 2022-09-06 18:33:38 +00:00
Pavel Mikhailovskii 6a14400342 KT-53804 Restore old and incorrect logic of generating InnerClasses attributes for kotlin-stdlib 2022-09-05 14:02:52 +00:00
Pavel Kunyavskiy 4d64f3a422 Ignore added test for JS backend 2022-09-05 12:20:21 +00:00
Alexander Korepanov 01507281a2 [Common IR] Forward the extension receiver in the reified wrapper
^KT-53672 Fixed
2022-09-05 07:40:30 +00:00