Commit Graph

472 Commits

Author SHA1 Message Date
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
Alexander Udalov 6734f542b3 JVM IR: sanitize indy lambda proxy names correctly
In case there are several proxy functions for indy lambdas in the same
container, its names are "...__proxy", "...__proxy-0", "...__proxy-1",
..., yet before this change, only the first one was sanitized. So if
it's happening inside a constructor, `<init>` was left unrenamed which
led to ClassFormatError.

 #KT-52040 Fixed
2022-04-21 17:06:16 +02:00
Dmitry Petrov 12d8b189a9 JVM_IR KT-50856 fix generic signature for SAM proxy function 2022-01-20 10:41:55 +00:00
Dmitry Petrov 5946242d75 JVM_IR fix special bridges in mixed Java/Kotlin hierarchies
KT-50257 KT-50476
2021-12-29 13:29:19 +00:00
Dmitry Petrov 9375f41936 JVM_IR KT-50073 inline callable reference adapter into 'invoke' 2021-12-14 14:35:12 +00:00
Ivan Kylchik b131c52889 Drop all usages of WITH_RUNTIME directive 2021-12-13 18:07:11 +03:00
Anastasiya Shadrina 2d088196ce [FE] Fill DESCRIPTOR_TO_CONTEXT_RECEIVER_MAP only with CR enabled 2021-12-02 20:25:06 +03:00
Anastasiya Shadrina 6cd50bc438 [Tests] Add bytecodeListing tests 2021-12-02 20:24:26 +03:00
Dmitry Petrov 55d1fdfbc2 JVM_IR prevent clash of unsubstituted special bridges 2021-11-23 12:05:13 +00:00
Dmitry Petrov 30ceb49442 JVM_IR KT-48945 generate special bridge with unsubstituted signature 2021-11-17 17:44:01 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Dmitry Petrov 6e9cbf52b1 JVM_IR make $deserializeLambda$ method synthetic 2021-10-23 11:21:26 +03:00
Dmitry Petrov 2a00def84e JVM_IR make proxy funs for inline and arrayOf funs non-synthetic 2021-10-13 16:07:53 +03:00
Dmitry Petrov b184c72e3d JVM_IR make proxy funs synthetic, fix some typos 2021-10-12 15:56:35 +03:00
Dmitry Petrov 146f0f4904 JVM_IR KT-41214 emit PermittedSubclasses on JDK17+ 2021-10-09 17:07:35 +03:00
Mads Ager b61389f6f9 [JVM IR] Do not generate clinit as enclosing method.
The JVM and newer Android runtimes treats that the same as if
there is no enclosing method. However, older Android runtimes
for Android 5 and 6 throw exceptions on reflective access
and even older runtimes have different behavior. To avoid
those issues, exclude <clinit> from enclosing method attributes.

^ KT-48754 Fixed
2021-09-30 23:02:43 +02:00