[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>
This commit is contained in:
committed by
Space Team
parent
57eae167cc
commit
a9343aeb7d
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: -ProhibitComparisonOfIncompatibleEnums
|
||||
|
||||
enum class A {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: -ProhibitComparisonOfIncompatibleEnums
|
||||
|
||||
enum class A {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_CASES_COUNT: function=box$lambda count=0
|
||||
// CHECK_IF_COUNT: function=box$lambda count=1 TARGET_BACKENDS=JS
|
||||
// CHECK_IF_COUNT: function=box$lambda count=0 IGNORED_BACKENDS=JS
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_CASES_COUNT: function=box count=6
|
||||
// CHECK_IF_COUNT: function=box count=1
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_CASES_COUNT: function=box count=18
|
||||
// CHECK_IF_COUNT: function=box count=3
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// CHECK_CASES_COUNT: function=crash count=2 TARGET_BACKENDS=JS
|
||||
// CHECK_CASES_COUNT: function=crash count=0 IGNORED_BACKENDS=JS
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// CHECK_CASES_COUNT: function=doTheThing count=2 TARGET_BACKENDS=JS
|
||||
// CHECK_CASES_COUNT: function=doTheThing count=0 IGNORED_BACKENDS=JS
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
enum class MyEnum {
|
||||
First,
|
||||
Second
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
enum class ABCD {
|
||||
A, B, C, D
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
enum class ABCD {
|
||||
A, B, C, D
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_CASES_COUNT: function=box count=0
|
||||
// CHECK_IF_COUNT: function=box count=1
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
enum class E {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
enum class E {
|
||||
A, B;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// CHECK_CASES_COUNT: function=test count=0 TARGET_BACKENDS=JS
|
||||
// CHECK_CASES_COUNT: function=test count=3 IGNORED_BACKENDS=JS
|
||||
// WITH_STDLIB
|
||||
// CHECK_CASES_COUNT: function=test count=0 TARGET_BACKENDS=JS;JS_IR;JS_IR_ES6
|
||||
// CHECK_CASES_COUNT: function=test count=3 IGNORED_BACKENDS=JS;JS_IR;JS_IR_ES6
|
||||
// CHECK_IF_COUNT: function=test count=3 TARGET_BACKENDS=JS
|
||||
// CHECK_IF_COUNT: function=test count=0 IGNORED_BACKENDS=JS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user