Files
kotlin-fork/js/js.translator/testData/box/native/castToNullableNativeInterface.kt
T
2018-04-19 13:17:28 +03:00

13 lines
257 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// EXPECTED_REACHABLE_NODES: 1109
external interface I {
fun foo(): String
}
fun createObject(): Any? = null
fun box(): String {
val result = (createObject() as I?)?.foo()
return if (result == null) "OK" else "fail"
}