Files
kotlin-fork/compiler/testData/diagnostics/tests/secondaryConstructors/argumentsResolveInBodyAndDelegationCall.kt
T
Denis Zharkov 3509cafcea Allow no super class initialization within header
if there is no primary constructor
2015-03-11 17:45:23 +03:00

26 lines
879 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(open val parentProp: Int)
val global: Int = 1
class A : B {
val myProp: Int = 1
override val parentProp = 1
constructor(x: Int, y: Int = global): super(x + y + global) {
foo(x, y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: Double, y: Int): this(x.toInt() + y, x.toInt() * y) {
foo(x.toInt(), y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: String, y: Int): super(<!TYPE_MISMATCH!>x<!>) {
foo(<!TYPE_MISMATCH!>x<!>, y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: B, y: Int = <!UNRESOLVED_REFERENCE!>global2<!>): <!NONE_APPLICABLE!>this<!>("", x) {
x.parentProp + y + myProp + parentProp + super.parentProp
}
fun foo(x: Int, y: Int, z: Int) = x
}