[FIR] Generate an error primary constructor when super call is invalid

Merge-request: KT-MR-11026
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
Egor Kulikov
2023-07-13 17:37:48 +00:00
committed by Space Team
parent a588e75c11
commit 70d49999ac
30 changed files with 523 additions and 75 deletions
@@ -20,6 +20,10 @@ FILE: explicitDelegationCallRequired.kt
}
public final class C : R|A| {
public error_constructor(): R|C| {
super<R|A|>(Int(20))
}
public constructor(): R|C| {
super<R|A|>()
}
@@ -9,7 +9,7 @@ class B : A {
<!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>class C : A(20) {
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
constructor(z: String) : this()
constructor(z: String) : <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>()
}<!>
class D() : A(20) {
@@ -6,6 +6,10 @@ FILE: interfaceWithSuperclass.kt
}
public abstract interface B : R|A| {
public error_constructor(): R|B| {
super<R|A|>()
}
}
public abstract interface C : R|kotlin/Any| {
}
@@ -16,4 +20,9 @@ FILE: interfaceWithSuperclass.kt
}
public abstract interface E : R|A|, R|C|, R|D| {
public error_constructor(): R|E| {
super<R|A|>()
super<R|D|>()
}
}
@@ -2,6 +2,10 @@ FILE: supertypeInitializedInInterface.kt
public abstract interface A : R|kotlin/Any| {
}
public abstract interface B : R|A| {
public error_constructor(): R|B| {
super<R|A|>()
}
}
public open class C : R|kotlin/Any| {
public constructor(): R|C| {
@@ -10,8 +14,22 @@ FILE: supertypeInitializedInInterface.kt
}
public abstract interface D : R|C| {
public error_constructor(): R|D| {
super<R|C|>()
}
}
public abstract interface E : R|kotlin/Any| {
public error_constructor(): R|E| {
super<R|kotlin/Any|>()
}
}
public abstract interface F : R|A|, R|B|, R|C|, R|D|, R|kotlin/Any| {
public error_constructor(): R|F| {
super<R|B|>()
super<R|D|>()
super<R|kotlin/Any|>()
}
}
@@ -1,6 +1,6 @@
interface A
interface B : <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>()
interface B : <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!><!NO_CONSTRUCTOR!>()<!>
open class C
@@ -36,6 +36,10 @@ FILE: supertypeInitializedWithoutPrimaryConstructor.kt
}
public final class G : R|C| {
public error_constructor(): R|G| {
super<R|C|>(Int(10))
}
public constructor(): R|G| {
super<R|C|>(Int(1))
}
@@ -20,6 +20,10 @@ FILE: withSuppression.kt
public abstract interface A : R|kotlin/Any| {
}
public abstract interface B : R|@R|kotlin/Suppress|(names = vararg(String(SUPERTYPE_INITIALIZED_IN_INTERFACE))) A| {
public error_constructor(): R|B| {
super<R|@R|kotlin/Suppress|(names = vararg(String(SUPERTYPE_INITIALIZED_IN_INTERFACE))) A|>()
}
}
public final data class D : R|kotlin/Any| {
@R|kotlin/Suppress|(names = vararg(String(DATA_CLASS_VARARG_PARAMETER))) public constructor(vararg x: R|kotlin/Array<out kotlin/String>|): R|D| {
@@ -15,6 +15,6 @@ typealias Alias<T> = @Suppress("TYPEALIAS_SHOULD_EXPAND_TO_CLASS") T
interface A
interface B : @Suppress("SUPERTYPE_INITIALIZED_IN_INTERFACE") A()
interface B : @Suppress("SUPERTYPE_INITIALIZED_IN_INTERFACE") A<!NO_CONSTRUCTOR!>()<!>
data class D @Suppress("DATA_CLASS_VARARG_PARAMETER") constructor(vararg val x: String)