[FIR] Fix incorrect diagnostic behaviour + several enum diagnostics

This commit is contained in:
Nick
2020-08-03 18:01:58 +03:00
committed by Mikhail Glukhikh
parent b76f757d47
commit f74eb07203
18 changed files with 283 additions and 21 deletions
@@ -0,0 +1,6 @@
enum class A {
A(1), B(2), C("test");
constructor(x: Int) : <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>()
constructor(t: String) : this(10)
}
@@ -0,0 +1,38 @@
FILE: delegationSuperCallInEnumConstructor.kt
public final enum class A : R|kotlin/Enum<A>| {
public final static enum entry A: R|A| = object : R|A| {
private constructor(): R|<anonymous>| {
super<R|A|>(Int(1))
}
}
public final static enum entry B: R|A| = object : R|A| {
private constructor(): R|<anonymous>| {
super<R|A|>(Int(2))
}
}
public final static enum entry C: R|A| = object : R|A| {
private constructor(): R|<anonymous>| {
super<R|A|>(String(test))
}
}
private constructor(x: R|kotlin/Int|): R|A| {
super<R|kotlin/Enum<A>|>()
}
private constructor(t: R|kotlin/String|): R|A| {
this<R|A|>(Int(10))
}
public final static fun values(): R|kotlin/Array<A>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|A| {
}
}
@@ -0,0 +1,18 @@
class A(x: Int) {
constructor(z: String) : this(10)
}
class B : A {
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor()<!>
constructor(z: String) : this()
}
<!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>class C : A(20) {
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor()<!>
constructor(z: String) : this()
}<!>
class D() : A(20) {
<!NONE_APPLICABLE, PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(x: Int)<!>
constructor(z: String) : this()
}
@@ -0,0 +1,45 @@
FILE: explicitDelegationCallRequired.kt
public final class A : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|A| {
super<R|kotlin/Any|>()
}
public constructor(z: R|kotlin/String|): R|A| {
this<R|A|>(Int(10))
}
}
public final class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
public constructor(z: R|kotlin/String|): R|B| {
this<R|B|>()
}
}
public final class C : R|A| {
public constructor(): R|C| {
super<R|A|>()
}
public constructor(z: R|kotlin/String|): R|C| {
this<R|C|>()
}
}
public final class D : R|A| {
public constructor(): R|D| {
super<R|A|>(Int(20))
}
public constructor(x: R|kotlin/Int|): R|D| {
super<R|A|>()
}
public constructor(z: R|kotlin/String|): R|D| {
this<R|D|>()
}
}
@@ -0,0 +1,9 @@
data class A {}
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class B {
constructor()
}<!>
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class C {
constructor(x: Int)
}<!>
@@ -0,0 +1,21 @@
FILE: primaryConstructorRequiredForDataClass.kt
public final data class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun copy(): R|A|
}
public final data class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
}
public final data class C : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|C| {
super<R|kotlin/Any|>()
}
}