[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
-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[]
|
||||
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[]
|
||||
}
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// WITH_STDLIB
|
||||
|
||||
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[]
|
||||
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[]
|
||||
}
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// WITH_STDLIB
|
||||
|
||||
enum class E { X }
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user