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 toebd43fc8c0. 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 after64c8ce18a0.
This commit is contained in:
committed by
Space Team
parent
cb65d2420f
commit
db31f1f926
@@ -5,7 +5,7 @@
|
|||||||
// ^ Check that there's only one $EntriesIntrinsicMappings class, with three fields (entries$0, entries$1, entries$2).
|
// ^ Check that there's only one $EntriesIntrinsicMappings class, with three fields (entries$0, entries$1, entries$2).
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// !LANGUAGE: +EnumEntries
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: X.kt
|
// FILE: X.kt
|
||||||
|
|
||||||
enum class X {
|
enum class X {
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ Module: lib
|
|||||||
@kotlin.Metadata
|
@kotlin.Metadata
|
||||||
public final enum class X {
|
public final enum class X {
|
||||||
// source: 'X.kt'
|
// source: 'X.kt'
|
||||||
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
|
|
||||||
private synthetic final static field $VALUES: X[]
|
private synthetic final static field $VALUES: X[]
|
||||||
public final enum static field X1: X
|
public final enum static field X1: X
|
||||||
public final enum static field X2: X
|
public final enum static field X2: X
|
||||||
private synthetic final static method $values(): X[]
|
private synthetic final static method $values(): X[]
|
||||||
static method <clinit>(): void
|
static method <clinit>(): void
|
||||||
private method <init>(p0: java.lang.String, p1: int): void
|
private method <init>(p0: java.lang.String, p1: int): void
|
||||||
public static @org.jetbrains.annotations.NotNull method getEntries(): kotlin.enums.EnumEntries
|
|
||||||
public static method valueOf(p0: java.lang.String): X
|
public static method valueOf(p0: java.lang.String): X
|
||||||
public static method values(): X[]
|
public static method values(): X[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM
|
// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
|
||||||
|
|
||||||
import kotlin.enums.*
|
import kotlin.enums.*
|
||||||
|
|
||||||
enum class E { A, B, C };
|
enum class E { A, B, C }
|
||||||
|
|
||||||
@OptIn(kotlin.ExperimentalStdlibApi::class)
|
@OptIn(kotlin.ExperimentalStdlibApi::class)
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
if (enumEntries<E>() != listOf(E.A, E.B, E.C)) return "FAIL"
|
if (enumEntries<E>() != listOf(E.A, E.B, E.C)) return "FAIL"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
// IGNORE_BACKEND: JS, JVM
|
// IGNORE_BACKEND: JS, JVM
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
|
||||||
|
|
||||||
import kotlin.enums.*
|
import kotlin.enums.*
|
||||||
|
|
||||||
|
|
||||||
enum class EnumWithClash {
|
enum class EnumWithClash {
|
||||||
values,
|
values,
|
||||||
entries,
|
entries,
|
||||||
@@ -21,4 +18,4 @@ fun box(): String {
|
|||||||
if (EnumWithClash.entries.toString() != "entries") return "FAIL 2"
|
if (EnumWithClash.entries.toString() != "entries") return "FAIL 2"
|
||||||
if (enumEntries<EnumWithClash>().toString() != "[values, entries, valueOf]") return "FAIL 3"
|
if (enumEntries<EnumWithClash>().toString() != "[values, entries, valueOf]") return "FAIL 3"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: MyEnum.kt
|
// FILE: MyEnum.kt
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
+1
@@ -3,6 +3,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
Vendored
+1
@@ -3,6 +3,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: MyEnums.kt
|
// FILE: MyEnums.kt
|
||||||
enum class MyEnum {
|
enum class MyEnum {
|
||||||
N, O
|
N, O
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: MyEnums.kt
|
// FILE: MyEnums.kt
|
||||||
enum class MyEnum {
|
enum class MyEnum {
|
||||||
N, O
|
N, O
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
// !LANGUAGE: -EnumEntries
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
enum class X {
|
enum class X {
|
||||||
|
|||||||
Reference in New Issue
Block a user