Files
kotlin-fork/compiler/testData/codegen/box/secondaryConstructors/accessToCompanion.kt
T
Denis Zharkov 01e5ee718f Allow secondary constructors without body
#KT-6967 Fixed
2015-03-27 16:09:40 +03:00

22 lines
389 B
Kotlin

class A(val result: Int) {
companion object {
fun foo(): Int = 1
val prop = 2
val C = 3
}
object B {
fun bar(): Int = 4
val prop = 5
}
object C {
}
constructor() : this(foo() + prop + B.bar() + B.prop + C)
}
fun box(): String {
val result = A().result
if (result != 15) return "fail: $result"
return "OK"
}