[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
+23
-14
@@ -43,6 +43,7 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
|
|
||||||
internal val enumClassPhase = makeIrFilePhase(
|
internal val enumClassPhase = makeIrFilePhase(
|
||||||
::EnumClassLowering,
|
::EnumClassLowering,
|
||||||
@@ -122,21 +123,26 @@ private class EnumClassLowering(private val context: JvmBackendContext) : ClassL
|
|||||||
// Construct the synthetic $VALUES field, which contains an array of all enum entries by calling $values()
|
// Construct the synthetic $VALUES field, which contains an array of all enum entries by calling $values()
|
||||||
val valuesField = buildValuesField(valuesHelperFunction)
|
val valuesField = buildValuesField(valuesHelperFunction)
|
||||||
|
|
||||||
val entriesField: IrField?
|
val entriesField = when {
|
||||||
if (supportsEnumEntries) {
|
irClass.declarations.any { it.isGetEntriesFunction } -> {
|
||||||
// Constructs the synthetic $entries() function that returns plain $VALUES without copy
|
// Constructs the synthetic $entries() function that returns plain $VALUES without copy
|
||||||
val entriesHelperFunction = buildEntriesHelperFunction(valuesField)
|
val entriesHelperFunction = buildEntriesHelperFunction(valuesField)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add synthetic $ENTRIES field and binds its initializer to
|
* Add synthetic $ENTRIES field and binds its initializer to
|
||||||
* ```
|
* ```
|
||||||
* val supplier: () -> E[] = indy LMF $entries
|
* val supplier: () -> E[] = indy LMF $entries
|
||||||
* $ENTRIES = EnumEntries(supplier)
|
* $ENTRIES = EnumEntries(supplier)
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
entriesField = buildEntriesField(entriesHelperFunction)
|
buildEntriesField(entriesHelperFunction)
|
||||||
} else {
|
}
|
||||||
entriesField = null
|
supportsEnumEntries -> {
|
||||||
|
error("kotlin.enums.EnumEntries is not available to the frontend. Is non-full kotlin stdlib being used?")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add synthetic parameters to enum constructors and implement the values and valueOf functions
|
// Add synthetic parameters to enum constructors and implement the values and valueOf functions
|
||||||
@@ -146,6 +152,9 @@ private class EnumClassLowering(private val context: JvmBackendContext) : ClassL
|
|||||||
irClass.transformChildrenVoid(EnumClassCallTransformer())
|
irClass.transformChildrenVoid(EnumClassCallTransformer())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val IrDeclaration.isGetEntriesFunction: Boolean
|
||||||
|
get() = this is IrFunction && name == SpecialNames.ENUM_GET_ENTRIES && origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER
|
||||||
|
|
||||||
private fun buildEnumEntryField(enumEntry: IrEnumEntry): IrField =
|
private fun buildEnumEntryField(enumEntry: IrEnumEntry): IrField =
|
||||||
context.cachedDeclarations.getFieldForEnumEntry(enumEntry).apply {
|
context.cachedDeclarations.getFieldForEnumEntry(enumEntry).apply {
|
||||||
initializer = IrExpressionBodyImpl(enumEntry.initializerExpression!!.expression.patchDeclarationParents(this))
|
initializer = IrExpressionBodyImpl(enumEntry.initializerExpression!!.expression.patchDeclarationParents(this))
|
||||||
|
|||||||
+4
@@ -25,6 +25,10 @@ public class foo/Kotlin : java/lang/Enum {
|
|||||||
|
|
||||||
public void <init>(java.lang.String $enum$name, int $enum$ordinal, java.lang.String s, kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
public void <init>(java.lang.String $enum$name, int $enum$ordinal, java.lang.String s, kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||||
|
|
||||||
|
()Lkotlin/enums/EnumEntries<Lfoo/Kotlin;>;
|
||||||
|
public static kotlin.enums.EnumEntries getEntries()
|
||||||
|
@Lorg/jetbrains/annotations/NotNull;([]) // invisible
|
||||||
|
|
||||||
public static foo.Kotlin valueOf(java.lang.String value)
|
public static foo.Kotlin valueOf(java.lang.String value)
|
||||||
|
|
||||||
public static foo.Kotlin[] values()
|
public static foo.Kotlin[] values()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IR_DIFFERENCE
|
// IR_DIFFERENCE
|
||||||
// EMIT_JVM_TYPE_ANNOTATIONS
|
// EMIT_JVM_TYPE_ANNOTATIONS
|
||||||
// RENDER_ANNOTATIONS
|
// RENDER_ANNOTATIONS
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
enum class SomeEnum {
|
enum class SomeEnum {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// !LANGUAGE: +NestedClassesInAnnotations
|
// !LANGUAGE: +NestedClassesInAnnotations
|
||||||
|
|
||||||
annotation class Foo(val kind: Kind) {
|
annotation class Foo(val kind: Kind) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface A<T> {
|
interface A<T> {
|
||||||
open fun foo(t: T) = "A"
|
open fun foo(t: T) = "A"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface A<T> {
|
interface A<T> {
|
||||||
open fun foo(t: T) = "A"
|
open fun foo(t: T) = "A"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: WASM
|
// IGNORE_BACKEND: WASM
|
||||||
// WASM_MUTE_REASON: FUNCTION_REFERENCES
|
// WASM_MUTE_REASON: FUNCTION_REFERENCES
|
||||||
// IGNORE_BACKEND: JS, JS_IR
|
// IGNORE_BACKEND: JS, JS_IR
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class E {
|
enum class E {
|
||||||
ENTRY
|
ENTRY
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface Named {
|
interface Named {
|
||||||
val name: String
|
val name: String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class E {
|
enum class E {
|
||||||
I
|
I
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
class Q {
|
class Q {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
package example2
|
package example2
|
||||||
|
|
||||||
fun box() = Context.OsType.OK.toString()
|
fun box() = Context.OsType.OK.toString()
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
abstract class Base(val fn: () -> Test)
|
abstract class Base(val fn: () -> Test)
|
||||||
|
|
||||||
enum class Test(val ok: String) {
|
enum class Test(val ok: String) {
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A(val a: Int = 1) {
|
enum class A(val a: Int = 1) {
|
||||||
FIRST(),
|
FIRST(),
|
||||||
SECOND(2)
|
SECOND(2)
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Foo(val a: Int = 1, val b: String) {
|
enum class Foo(val a: Int = 1, val b: String) {
|
||||||
B(2, "b"),
|
B(2, "b"),
|
||||||
C(b = "b")
|
C(b = "b")
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Foo(val a: Int = 1, val b: String = "a") {
|
enum class Foo(val a: Int = 1, val b: String = "a") {
|
||||||
A(),
|
A(),
|
||||||
B(2, "b"),
|
B(2, "b"),
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Foo(val a: Double = 1.0, val b: Double = 1.0) {
|
enum class Foo(val a: Double = 1.0, val b: Double = 1.0) {
|
||||||
A(),
|
A(),
|
||||||
B(2.0, 2.0),
|
B(2.0, 2.0),
|
||||||
|
|||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
@kotlin.Metadata
|
|
||||||
public final class Delegate {
|
|
||||||
// source: 'memberExtensionPropertyAndImportFromObject.kt'
|
|
||||||
public method <init>(): void
|
|
||||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final enum class E {
|
|
||||||
// source: 'memberExtensionPropertyAndImportFromObject.kt'
|
|
||||||
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
|
|
||||||
private synthetic final static field $VALUES: E[]
|
|
||||||
public final enum static field X: E
|
|
||||||
private synthetic final static method $entries(): E[]
|
|
||||||
private synthetic final static method $values(): E[]
|
|
||||||
static method <clinit>(): 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): E
|
|
||||||
public static method values(): E[]
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final class MemberExtensionPropertyAndImportFromObjectKt {
|
|
||||||
// source: 'memberExtensionPropertyAndImportFromObject.kt'
|
|
||||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
|
||||||
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
|
||||||
static method <clinit>(): void
|
|
||||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
|
||||||
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final class O {
|
|
||||||
// source: 'memberExtensionPropertyAndImportFromObject.kt'
|
|
||||||
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
|
|
||||||
static method <clinit>(): void
|
|
||||||
private method <init>(): void
|
|
||||||
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
|
|
||||||
}
|
|
||||||
+1
@@ -15,6 +15,7 @@ public final enum class E {
|
|||||||
private synthetic final static method $values(): E[]
|
private synthetic final static method $values(): E[]
|
||||||
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): E
|
public static method valueOf(p0: java.lang.String): E
|
||||||
public static method values(): E[]
|
public static method values(): E[]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// CHECK_BYTECODE_LISTING
|
// CHECK_BYTECODE_LISTING
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
import O.d
|
import O.d
|
||||||
|
|
||||||
|
|||||||
-39
@@ -1,39 +0,0 @@
|
|||||||
@kotlin.Metadata
|
|
||||||
public final class Delegate {
|
|
||||||
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
|
|
||||||
public method <init>(): void
|
|
||||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final enum class E {
|
|
||||||
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
|
|
||||||
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
|
|
||||||
private synthetic final static field $VALUES: E[]
|
|
||||||
public final enum static field X: E
|
|
||||||
private synthetic final static method $entries(): E[]
|
|
||||||
private synthetic final static method $values(): E[]
|
|
||||||
static method <clinit>(): 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): E
|
|
||||||
public static method values(): E[]
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final class MemberExtensionPropertyAndLocalDelegatedPropertyKt {
|
|
||||||
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
|
|
||||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
|
||||||
static method <clinit>(): void
|
|
||||||
private final static method box$lambda$1$lambda$0(p0: Delegate): java.lang.String
|
|
||||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.Metadata
|
|
||||||
public final class O {
|
|
||||||
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
|
|
||||||
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
|
|
||||||
static method <clinit>(): void
|
|
||||||
private method <init>(): void
|
|
||||||
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
|
|
||||||
}
|
|
||||||
+1
@@ -15,6 +15,7 @@ public final enum class E {
|
|||||||
private synthetic final static method $values(): E[]
|
private synthetic final static method $values(): E[]
|
||||||
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): E
|
public static method valueOf(p0: java.lang.String): E
|
||||||
public static method values(): E[]
|
public static method values(): E[]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// CHECK_BYTECODE_LISTING
|
// CHECK_BYTECODE_LISTING
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
enum class E { X }
|
enum class E { X }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
// IGNORE_LIGHT_ANALYSIS
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
ONE,
|
ONE,
|
||||||
TWO;
|
TWO;
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
ONE,
|
ONE,
|
||||||
TWO
|
TWO
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
import A.ONE
|
import A.ONE
|
||||||
|
|
||||||
enum class A {
|
enum class A {
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
import A.ONE
|
import A.ONE
|
||||||
|
|
||||||
enum class A {
|
enum class A {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A() {
|
enum class A() {
|
||||||
ENTRY(){ override fun t() = "OK"};
|
ENTRY(){ override fun t() = "OK"};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class E {
|
enum class E {
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: Foo.java
|
// FILE: Foo.java
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: Foo.java
|
// FILE: Foo.java
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// http://youtrack.jetbrains.com/issue/KT-2167
|
// http://youtrack.jetbrains.com/issue/KT-2167
|
||||||
|
|
||||||
enum class Season {
|
enum class Season {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
private var logs = ""
|
private var logs = ""
|
||||||
|
|
||||||
enum class Foo(val text: String) {
|
enum class Foo(val text: String) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Game {
|
enum class Game {
|
||||||
ROCK,
|
ROCK,
|
||||||
PAPER,
|
PAPER,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
fun f(): String = "O"
|
fun f(): String = "O"
|
||||||
fun g(): String = "K"
|
fun g(): String = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_K2: JVM_IR
|
// IGNORE_BACKEND_K2: JVM_IR
|
||||||
// K2 status: declaringClass is error for enums since Kotlin 1.9
|
// K2 status: declaringClass is error for enums since Kotlin 1.9
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val x = "OK"
|
val x = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val k = "K"
|
val k = "K"
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Test(val str: String = "OK") {
|
enum class Test(val str: String = "OK") {
|
||||||
OK
|
OK
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Test(vararg xs: Int) {
|
enum class Test(vararg xs: Int) {
|
||||||
OK;
|
OK;
|
||||||
val values = xs
|
val values = xs
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Test(val str: String = "OK") {
|
enum class Test(val str: String = "OK") {
|
||||||
OK {
|
OK {
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
||||||
|
|
||||||
enum class Test {
|
enum class Test {
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
||||||
enum class Test(val x: Int, val str: String) {
|
enum class Test(val x: Int, val str: String) {
|
||||||
OK;
|
OK;
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
||||||
enum class Test(val x: Int, val str: String) {
|
enum class Test(val x: Int, val str: String) {
|
||||||
OK;
|
OK;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
// IGNORE_BACKEND_K2: JS_IR, NATIVE
|
||||||
package test
|
package test
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
enum class Empty
|
enum class Empty
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS
|
// DONT_TARGET_EXACT_BACKEND: JS
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A(
|
enum class A(
|
||||||
name: String,
|
name: String,
|
||||||
ordinal: Int
|
ordinal: Int
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
package test
|
package test
|
||||||
|
|
||||||
fun box() = MyEnum.E1.f() + MyEnum.E2.f()
|
fun box() = MyEnum.E1.f() + MyEnum.E2.f()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Color(val rgb: Int) {
|
enum class Color(val rgb: Int) {
|
||||||
RED(0xff0000),
|
RED(0xff0000),
|
||||||
GREEN(0x00ff00),
|
GREEN(0x00ff00),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: WASM
|
// IGNORE_BACKEND: WASM
|
||||||
enum class E { OK }
|
enum class E { OK }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// KT-4423 Enum with function not compiled
|
// KT-4423 Enum with function not compiled
|
||||||
// SKIP_MANGLE_VERIFICATION
|
// SKIP_MANGLE_VERIFICATION
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
enum class X {
|
enum class X {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
package test
|
package test
|
||||||
|
|
||||||
enum class Season {
|
enum class Season {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
fun box() = if(Context.operatingSystemType == Context.Companion.OsType.OTHER) "OK" else "fail"
|
fun box() = if(Context.operatingSystemType == Context.Companion.OsType.OTHER) "OK" else "fail"
|
||||||
|
|
||||||
public class Context
|
public class Context
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
var l = ""
|
var l = ""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
// IGNORE_BACKEND: WASM
|
// IGNORE_BACKEND: WASM
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
var l = ""
|
var l = ""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS
|
// DONT_TARGET_EXACT_BACKEND: JS
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||||
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
class A {
|
class A {
|
||||||
enum class E {
|
enum class E {
|
||||||
OK
|
OK
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val x = "OK"
|
val x = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val x = "OK"
|
val x = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val x = "OK"
|
val x = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
class A {
|
class A {
|
||||||
companion object {}
|
companion object {}
|
||||||
enum class E {
|
enum class E {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Direction() {
|
enum class Direction() {
|
||||||
NORTH {
|
NORTH {
|
||||||
val someSpecialValue = "OK"
|
val someSpecialValue = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Bar {
|
enum class Bar {
|
||||||
ONE,
|
ONE,
|
||||||
TWO
|
TWO
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// SKIP_DCE_DRIVEN
|
// SKIP_DCE_DRIVEN
|
||||||
|
|
||||||
enum class Bar {
|
enum class Bar {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Test(val x: String, val closure1: () -> String) {
|
enum class Test(val x: String, val closure1: () -> String) {
|
||||||
FOO("O", { FOO.x }) {
|
FOO("O", { FOO.x }) {
|
||||||
override val y: String = "K"
|
override val y: String = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class Test(val x: String, val closure1: () -> String) {
|
enum class Test(val x: String, val closure1: () -> String) {
|
||||||
FOO("O", run { { FOO.x } }) {
|
FOO("O", run { { FOO.x } }) {
|
||||||
override val y: String = "K"
|
override val y: String = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// SKIP_MANGLE_VERIFICATION
|
// SKIP_MANGLE_VERIFICATION
|
||||||
enum class Foo(
|
enum class Foo(
|
||||||
val x: String,
|
val x: String,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
// SKIP_MANGLE_VERIFICATION
|
// SKIP_MANGLE_VERIFICATION
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun invoke(): String
|
fun invoke(): String
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class A(val b: String) {
|
enum class A(val b: String) {
|
||||||
E1("OK"){ override fun t() = b };
|
E1("OK"){ override fun t() = b };
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class E(val b: Boolean) {
|
enum class E(val b: Boolean) {
|
||||||
TRUE(1 == 1)
|
TRUE(1 == 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class ContentType {
|
enum class ContentType {
|
||||||
|
|
||||||
PLAIN_TEXT {
|
PLAIN_TEXT {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(e: En): String
|
fun foo(e: En): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
fun call(f: () -> Unit) {
|
fun call(f: () -> Unit) {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
val value2 = "K"
|
val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
val value2 = "K"
|
val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
val value2 = "K"
|
val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
override val value = "OK"
|
override val value = "OK"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
override val value2 = "K"
|
override val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
override val value2 = "K"
|
override val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
B {
|
B {
|
||||||
val value2 = "K"
|
val value2 = "K"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
fun <T, R> T.letNoInline(fn: (T) -> R) =
|
fun <T, R> T.letNoInline(fn: (T) -> R) =
|
||||||
fn(this)
|
fn(this)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class X {
|
enum class X {
|
||||||
|
|
||||||
B {
|
B {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
enum class IssueState {
|
enum class IssueState {
|
||||||
|
|
||||||
FIXED {
|
FIXED {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user