Files
kotlin-fork/js/js.translator/testData/box/coercion/ifWithUnit.kt
T
Alexey Andreev 3b3fd0fa0d JS: fix DCE limits in test data to fit new kotlin.js size
The size has increased due to new implementation of KClass
2017-10-06 18:16:51 +03:00

19 lines
330 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1113
var log = ""
fun foo() {
log += "foo()"
}
fun test(x: Int) = if (x < 10) foo() else 55
fun box(): String {
val a = test(20)
if (a !is Int) return "fail1: $a"
val b = test(5)
if (b !is Unit) return "fail2: $b"
if (log != "foo()") return "fail3: $log"
return "OK"
}