Files
kotlin-fork/compiler/testData/codegen/box/constructorCall/possiblyPoppedUnitializedValueInArguments.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

36 lines
719 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_STDLIB
// FILE: test.kt
fun box(): String {
for (count in 0..3) {
val test = Foo(count, Foo(1, "x", if (count > 0) break else 2), 3)
if (count > 0) return "Fail: count = $count"
if (test.toString() != "Foo(0,Foo(1,x,2),3)") return "Fail: ${test.toString()}"
}
return "OK"
}
// FILE: util.kt
val log = StringBuilder()
fun <T> logged(msg: String, value: T): T {
log.append(msg)
return value
}
// FILE: Foo.kt
class Foo(val a: Int, val b: Any, val c: Int) {
init {
log.append("<init>")
}
override fun toString() = "Foo($a,$b,$c)"
companion object {
init {
log.append("<clinit>")
}
}
}