Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/diagnostics/cyclicConstructorDelegationCall.kt
T
2021-05-13 16:13:43 +03:00

68 lines
1.8 KiB
Kotlin
Vendored

class B
class C
class A() {
constructor(a: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>("test") {}
constructor(a: String) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(10) {}
constructor(a: Boolean) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>('\n') {}
constructor(a: Char) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(0.0) {}
constructor(a: Double) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(false) {}
constructor(b: B) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3.14159265) {}
constructor(c: C) : this() {}
constructor(a: List<Int>) : this(C()) {}
}
class D {
constructor(i: Boolean) {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3) {}
}
class E<T> {
// this is not an error about the
// selection of the proper constructor
// but a type mismatch for the first
// argument
constructor(e: T, i: Int) : this(<!ARGUMENT_TYPE_MISMATCH!>i<!>, 10) {}
}
class I<T> {
// this is not an error about the
// selection of the proper constructor
// but a type mismatch for the first
// argument
constructor(e: T, i: Int) : this(<!ARGUMENT_TYPE_MISMATCH!>i<!>, 10)
}
class J<T> {
constructor(e: T, i: Int) : this(i, 10)
constructor(e: Int, i: Int)
}
class F(s: String) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(i: Boolean)<!> {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3) {}
}
class G(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!> {}
}
class H(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!>
}
class K(x: Int) {
constructor() : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {}
}
open class M {
constructor(m: Int)
}
class U : M {
constructor()
}