KT-7897 Do not require to call enum constructor for each entry if all parameters have default values
Do not report an error on enum entry without initializer if all parameters have default values (error is still reported if there is no such constructor, or if the constructor call is ambiguous). Record resolved call on KtEnumEntry. NB is the enum entry has a corresponding subclass, we still have to generate the "default" constructor call, because FE doesn't know about the platform-specific representation of that class and its constructors. See also KT-14097, KT-15900
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
@kotlin.Metadata
|
||||
public final class ConstructorWithDefaultArgumentsKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public enum class Test {
|
||||
public final static field OK: Test
|
||||
private final @org.jetbrains.annotations.NotNull field str: java.lang.String
|
||||
protected method <init>(@java.lang.Synthetic p0: java.lang.String, @java.lang.Synthetic p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
synthetic method <init>(p0: java.lang.String, p1: int, p2: java.lang.String, p3: int, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStr(): java.lang.String
|
||||
public static method valueOf(p0: java.lang.String): Test
|
||||
public static method values(): Test[]
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
@kotlin.Metadata
|
||||
public final class ConstructorWithVarargKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public enum class Test {
|
||||
public final static field OK: Test
|
||||
private final @org.jetbrains.annotations.NotNull field values: int[]
|
||||
protected method <init>(@java.lang.Synthetic p0: java.lang.String, @java.lang.Synthetic p1: int, @org.jetbrains.annotations.NotNull p2: int[]): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValues(): int[]
|
||||
public static method valueOf(p0: java.lang.String): Test
|
||||
public static method values(): Test[]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
@kotlin.Metadata
|
||||
public final class SecondaryConstructorWithDefaultArgumentsKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public enum class Test {
|
||||
public final static field OK: Test
|
||||
private final @org.jetbrains.annotations.NotNull field str: java.lang.String
|
||||
private final field x: int
|
||||
protected method <init>(@java.lang.Synthetic p0: java.lang.String, @java.lang.Synthetic p1: int, p2: int, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
|
||||
protected method <init>(p0: java.lang.String, p1: int, p2: int): void
|
||||
synthetic method <init>(p0: java.lang.String, p1: int, p2: int, p3: int, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStr(): java.lang.String
|
||||
public final method getX(): int
|
||||
public static method valueOf(p0: java.lang.String): Test
|
||||
public static method values(): Test[]
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
@kotlin.Metadata
|
||||
public final class SecondaryConstructorWithVarargKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public enum class Test {
|
||||
public final static field OK: Test
|
||||
private final @org.jetbrains.annotations.NotNull field str: java.lang.String
|
||||
private final field x: int
|
||||
protected method <init>(@java.lang.Synthetic p0: java.lang.String, @java.lang.Synthetic p1: int, @org.jetbrains.annotations.NotNull p2: int[]): void
|
||||
protected method <init>(@java.lang.Synthetic p0: java.lang.String, @java.lang.Synthetic p1: int, p2: int, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStr(): java.lang.String
|
||||
public final method getX(): int
|
||||
public static method valueOf(p0: java.lang.String): Test
|
||||
public static method values(): Test[]
|
||||
}
|
||||
Reference in New Issue
Block a user