Files
kotlin-fork/compiler/testData/codegen/box/when/kt5448.kt
T
2019-11-19 11:00:09 +03:00

25 lines
378 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
class A
class B(val items: Collection<A>)
class C {
fun foo(p: Int) {
when (p) {
1 -> arrayListOf<Int>().add(1)
}
}
fun bar() = B(listOf<A>().map { it })
}
fun box(): String {
C().foo(1)
if (C().bar().items.isNotEmpty()) return "fail"
return "OK"
}