Commit Graph

487 Commits

Author SHA1 Message Date
Artem Kobzar da4c6dd443 [K/JS, K/N, K/Wasm] Fix more general case of the ^KT-61929 issue 2024-01-02 12:18:34 +00:00
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Kirill Rakhman 984493fe8b [Tests] Add regression test for #KT-62865 2023-12-15 16:25:46 +00:00
Alexander Udalov 968dfddbc9 Tests: adjust test data for bytecode listing tests
- remove obsolete `IGNORE_BACKEND: JVM` directives
- move contents of .ir.txt files to the corresponding .txt
2023-11-02 10:59:29 +00:00
Alexander Udalov 9ae16fd66e Tests: unmute bytecode listing tests for JVM_IR
Mute them for the old JVM backend instead. JVM IR behavior is fine in
all cases except maybe `destructured.kt`, for which there's now an issue
KT-63075.
2023-11-02 10:59:28 +00:00
vladislav.grechko 897eab6b50 Do not add nullability annotations to the methods of local classes
Nullability annotations are useless for the methods of local classes
due to their restricted scope.

^KT-62513: Fixed
2023-10-18 19:48:38 +00:00
Dmitriy Novozhilov 9366847e96 [FIR2IR] Properly approximate intersection types during fir2ir conversion
^KT-62544 Fixed
2023-10-18 13:02:11 +00:00
Dmitriy Novozhilov 3b6ad36af1 [Test] Update/unmute tests after previous fixes
It's hard to tell which exact commit fixed each test
2023-10-17 12:46:28 +00:00
vladislav.grechko 29eb1c7a63 Do not add nullability annotations to the methods of anonymous classes
Nullability annotations are useless for the methods of anonymous classes
due to their restricted scope.

^KT-62044: Fixed
2023-10-10 10:34:33 +00:00
Denis.Zharkov 2e5b783cc6 K2: Refine how JDK members are mapped to built-in classes
Previously, the semantic was more-or-less correct for most of the cases
but some corner one, like `sort` in MutableList didn't work properly.

Namely, `sort` should be marked there in a way to forbid to call it
everywhere beside super-calls.
Also, overriding it should be allowed.

Mostly, the logic was re-written to K2 model from K1-related
JvmBuiltInsCustomizer.

^KT-57694 In progress
^KT-57269 Fixed
2023-05-30 10:44:41 +00:00
Alexander Udalov 83865782ff FIR: do not generate annotations on properties from delegation
#KT-57228 Fixed
2023-05-22 20:12:29 +00:00
Alexander Udalov 40c628d431 FIR: fix order of property accessor annotations
#KT-57219 Fixed
2023-05-22 20:12:29 +00:00
Alexander Udalov 9c995755f0 Remove obsolete backend test on getter-targeted annotations
`@get:... get` is no longer allowed, see the explanation in KT-15470.
2023-05-22 20:12:29 +00:00
Alexander Udalov 68b94b07b8 Fir2Ir: more precise calculation of enum class modality
Use the same condition as in the already existing `createIrEnumEntry`
function (and as in psi2ir): enum class should be final unless there's
an enum entry with any declaration other than its constructor.

 #KT-57216
2023-04-27 11:02:22 +00:00
Alexander Udalov 3120a35a88 JvmDefault: remove most tests on @JvmDefault
The tests are removed because JvmDefault is going to be deprecated with
error in KT-54746 and removed later in KT-57696.

Many of the removed tests already had existing counterparts with the new
modes `all` and `all-compatibility`. In this change, I've added such
tests where they were missing, and removed tests which were testing
behavior specific to the JvmDefault annotation, such as some
diagnostics.

 #KT-54746
2023-04-25 14:33:00 +00:00
Evgeniy.Zhelenskiy 8c748bfea4 [IR] Add more tests for inline/value classes secondary constructors
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2023-04-17 12:10:14 +00:00
Alexander Udalov 14c2030595 Merge K2 bytecodeListing tests to main bytecodeListing tests 2023-03-27 10:32:17 +00:00
Alexander Udalov 562b27db4e JVM IR: initialize enum entries without invokedynamic
#KT-57316 Fixed
2023-03-24 13:38:32 +00:00
Nikolay Lunyak 505edb9746 [FIR2IR] KT-57211: Support unsigned arrayOf-s in fir2ir
^KT-57211 Fixed

Merge-request: KT-MR-9294
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-03-22 13:10:17 +00:00
Alexander Udalov f0fba7be64 K2: add bytecode listing tests
#KT-57171 Fixed
2023-03-14 21:57:26 +01:00
Evgeniy.Zhelenskiy 3b5ad0681f [IR] Fix compiler bugs with MFVC to let KorGE run
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2023-03-13 13:09:56 +00:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
Alexander Udalov 641d636c45 JVM IR: improve generation of receiver for bound callable references
Trick codegen into generating getfield from the anonymous class instead
of its supertype (e.g. kotlin.jvm.internal.FunctionReference,
PropertyReference or AdaptedFunctionReference). This gets rid of
unnecessary accessors in some cases, and will help in the subsequent
commit that changes logic around access to fields from Java
superclasses.
2023-02-23 12:54:00 +01:00
Nikolay Lunyak a9343aeb7d [FIR] KT-55840: Ensure everything actually works
This inconsistency is present due to not using the `// WITH_STDLIB`
in the above tests. When K1 creates the enum, it tries to generate
`entries()`, and for that it tries to load `kotlin.enums.EnumEntries`,
but this is actually an unresolved reference. K1 silently swallows it,
and proceeds.

The reason K2 doesn't fail is that in order to generate `entries()` it
simply creates the necessary `ConeClassLikeType` with the desired
`classId` instead of loading the whole `ClassDescriptor`.

The reason we can still observe `$ENTRIES` and `$entries` in K1
is because they are generated during the JVM codegen, and it
only checks if the `EnumEntries` language feature is supported. It
doesn't check if the `entries` property has really existed in IR
(by this time it's expected to have already been lowered to the
`get-entries` function - that's why "has ... existed").

The reason why the codegen doesn't fail when working with
`kotlin.enums.EnumEntries` is because it creates its
own `IrClassSymbol`.

^KT-55840 Fixed

Merge-request: KT-MR-8727
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-10 16:57:51 +00:00
Pavel Mikhailovskii 4c7f8ba196 KT-56457 Annotate Enum.entries with @NotNull 2023-02-09 20:13:56 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Pavel Mikhailovskii 38a56ba8e8 KT-55308, KT-55769 Sort InnerClasses entries. Add DONT_SORT_DECLARATIONS directive 2023-01-13 01:07:10 +00:00
Dmitriy Novozhilov 6b343515e1 [Test] Save IR bytecode dumps from BytecodeListingHandler to .ir.txt file instead of _ir.txt
This is needed to keep consistency with other dumps and to allow
  test helper plugin to recognize those dumps
2022-12-01 07:29:37 +00:00
Evgeniy.Zhelenskiy fa4a4e56f3 [Tests] Remove unnecessary usages of OPTIONAL_JVM_INLINE_ANNOTATION
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:42 +00:00
Evgeniy.Zhelenskiy 68fb8aa2a1 [IR] Replace indexes with names for mfvc methods and fields
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:41 +00:00
Evgeniy.Zhelenskiy b692748938 [IR] Always add getter methods to value classes even if not used
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy 3653c86f08 [IR] Rename static replacement of MFVC typed equals to "equals-impl0"
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy 38c80192f9 [IR] Support MFVC-typed properties and interfaces delegates
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
vladislav.grechko e0c13e5276 Fix addAll & putAll invocations on inline mutable collections
^KT-54950: Fixed
2022-11-24 19:27:42 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Mads Ager 636024f676 [JVM] Retain deprecated status for interface companion const property.
Create the field directly and maintain the fact that its corresponding
property is the companion object property. That property has the
deprecated annotation which puts the deprecated marker on the field
when code generating the field.

^KT-54840 Fixed
2022-11-09 23:15:31 +01:00
Alexander Udalov 3d00c173f3 Fix binary compatibility for inlined local delegated properies
#KT-54650 Fixed
2022-11-01 12:34:33 +01:00
Johan Bay 9f3d8130db Remove unnecessary deprecation annotation
Private members on private companion objects have proper visibility
so there is no need for the @Deprecated annotation.

^KT-54539 Fixed
2022-10-25 14:03:11 +02:00
Alexander Udalov a09fd45ade Do not generate TYPE_USE/TYPE_PARAMETER when compiling against JDK 1.6
#KT-53712
2022-08-29 13:43:32 +02:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
Mikhail Glukhikh 8a4105e542 IR: fix origin of default getter of Enum.entries synthetic property 2022-08-19 10:08:08 +00:00
Mikhail Glukhikh 12e8b1d844 K1: add support for Enum.entries synthetic property (see KT-48872)
#KT-53270 Fixed
2022-08-12 09:35:24 +00:00
Vsevolod Tolstopyatov e708809e55 [JVM] Support Enum.entries for enums being compiled with Kotlin 1.8+
#KT-53236
2022-08-12 09:35:20 +00:00
Steven Schäfer 2acfb3a41f JVM IR: Avoid direct lambda invokes in inline tests 2022-07-14 23:24:18 +02:00
Mikhael Bogdanov 27cfe11d55 JvmDefaultWithoutCompatibility. Switch retention to source 2022-06-28 14:11:49 +02:00
Victor Petukhov fa7809cd80 [FE] Remove BuilderInference annotation from tests 2022-06-21 15:01:56 +02:00
Pavel Mikhailovskii ecb3cc193c KT-51883 Don't use "-" in generated unique lifted declaration names 2022-06-10 18:36:04 +00:00
Pavel Mikhailovskii 3b5179686e KT-52592 Fix NPE from KProperty.getExtensionDelegate on property delegated to another property; make $delegate methods private 2022-06-01 14:02:28 +00:00
Ivan Kylchik 20d0a531df Add new tests to check evaluation of intrinsic сonsts 2022-05-18 21:20:02 +03:00
Ivan Kylchik dca22d745a Drop excessive lowerings that are replaced by ConstEvaluationLowering 2022-05-18 21:20:02 +03:00