[FIR] skip implicit call to enum constructor if super type call exists
otherwise, reference to the super type would be resolved even when it's not e.g. for interface constructor ^ KTIJ-24437
This commit is contained in:
+2
-2
@@ -7,9 +7,9 @@ FILE: classInSupertypeForEnum.kt
|
||||
}
|
||||
public abstract interface C : R|kotlin/Any| {
|
||||
}
|
||||
public final enum class B : R|C|, R|A|, R|kotlin/Any|, R|kotlin/Enum<B>| {
|
||||
public final enum class B : R|C|, R|A|, R|kotlin/Any| {
|
||||
private constructor(): R|B| {
|
||||
super<R|kotlin/Enum<B>|>()
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<B>| {
|
||||
|
||||
+1
-1
@@ -538,7 +538,7 @@ class DeclarationsConverter(
|
||||
delegationSpecifiers?.let { superTypeRefs += it.superTypesRef }
|
||||
|
||||
when {
|
||||
modifiers.isEnum() && (classKind == ClassKind.ENUM_CLASS) -> {
|
||||
modifiers.isEnum() && (classKind == ClassKind.ENUM_CLASS) && delegatedConstructorSource == null -> {
|
||||
delegatedSuperTypeRef = buildResolvedTypeRef {
|
||||
type = ConeClassLikeTypeImpl(
|
||||
implicitEnumType.type.lookupTag,
|
||||
|
||||
@@ -881,7 +881,7 @@ open class RawFirBuilder(
|
||||
}
|
||||
|
||||
when {
|
||||
this is KtClass && classKind == ClassKind.ENUM_CLASS -> {
|
||||
this is KtClass && classKind == ClassKind.ENUM_CLASS && superTypeCallEntry == null -> {
|
||||
/*
|
||||
* kotlin.Enum constructor has (name: String, ordinal: Int) signature,
|
||||
* so we should generate non-trivial constructors for enum and it's entry
|
||||
|
||||
Reference in New Issue
Block a user