Commit Graph

17 Commits

Author SHA1 Message Date
Alexander Udalov 6219f7fc0d JVM IR: fix detection of enum entries in the same module
Use the new `IrClass.hasEnumEntries` flag added in the previous commit.

 #KT-61208 Fixed
2023-10-16 20:22:20 +00:00
Alexander Udalov db31f1f926 Tests: update some backend tests on enum entries
The enumEntriesIntrinsicMultipleEnums.kt test was supposed to check that
JVM backend generates 3 `$EntriesIntrinsicMappings` classes: for X, for
Y, and for Z. Mappings classes are generated for enums without
`entries`, i.e. Kotlin enums compiled without `EnumEntries` language
feature, and Java enums. The test incorrectly _enabled_ the language
feature for X though, and `$EntriesIntrinsicMappings` for X was
generated anyway because of KT-61208.

To keep the original intention of the test, I'm disabling the language
feature for X, so that it will be considered as enum without `entries`.
KT-61208 will be fixed in a separate commit (with separate tests).

The boxInline and bytecodeText tests changed their meaning when language
feature EnumEntries started to be enabled by default, so those changes
are a continuation to ebd43fc8c0. The behavior did not change after
enabling the feature, once again because of KT-61208.

Also, remove obsolete error suppressions which are no longer needed
after 64c8ce18a0.
2023-10-16 20:22:20 +00:00
Alexander Udalov 03fdba5aa7 Tests: minor, remove obsolete suppressions about enumEntries
The `enumEntries` intrinsic has been made public in 64c8ce18a0.
2023-08-04 09:57:34 +00:00
Alexander Udalov 971b4e63e7 JVM: support enumEntries intrinsic for Java & old Kotlin enums
#KT-59710 Fixed
2023-07-25 09:55:43 +00:00
Alexander Udalov 874d1c514a JVM: support enumEntries intrinsic for Kotlin enums
Implementation is very similar to the `enumValues` intrinsic.

Java enums and old (pre-1.9) Kotlin enums will be supported in a
subsequent commit.

 #KT-59710
2023-07-25 09:55:43 +00:00
Alexander Udalov f04d01cf21 JVM IR: fix behavior of Enum.entries for unlowered enums
#KT-57671 Fixed
2023-04-24 12:43:43 +00:00
Alexander Udalov 562b27db4e JVM IR: initialize enum entries without invokedynamic
#KT-57316 Fixed
2023-03-24 13:38:32 +00:00
Mikhail Glukhikh 8a4105e542 IR: fix origin of default getter of Enum.entries synthetic property 2022-08-19 10:08:08 +00:00
Vsevolod Tolstopyatov e3bff290bd [JVM] Lower .entries calls on Kotlin enums
Leveraging the same mechanism with $EntriesMapping as Java enums.
Old (compiled with LV/AV < 1.8) enums are detected by looking for
static special <get-entries> method that cannot be introduced on
Kotlin enums otherwise

#KT-53236
2022-08-12 09:35:22 +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 bea1a8c422 JVM IR: Use Object.clone in Enum.values 2021-03-16 21:30:18 +01:00
Steven Schäfer d62a6a2631 JVM IR: Do not create accessors for enum entry constructors 2020-07-20 22:37:49 +02:00
Steven Schäfer b6b8dd1eab JVM IR: Avoid unnecessary CHECKCASTs in enum classes 2020-04-28 16:31:13 +02:00
Mark Punzalan 368b0d9b0b [JVM IR] Use reference equality when comparing enums. 2020-03-06 23:01:32 +01:00
Dmitry Petrov 94d20d9176 Update bytecode text tests in JVM_IR 2020-02-17 23:52:48 +03:00
Mads Ager 3a11322506 Enable bytecode text tests for the JVM_IR backend. 2018-12-21 16:20:45 +01:00
Mikaël Peltier a2a3043607 KT-18731 Use reference equality to compare enums
Fix of https://youtrack.jetbrains.com/issue/KT-18731
2018-02-05 18:34:44 +03:00