Files
kotlin-fork/compiler/testData/ir/irText/expressions/safeCalls.kt
T
2023-03-22 15:18:17 +00:00

25 lines
394 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
class Ref(var value: Int)
interface IHost {
fun String.extLength() = length
}
fun test1(x: String?) = x?.length
fun test2(x: String?) = x?.hashCode()
fun test3(x: String?, y: Any?) = x?.equals(y)
fun test4(x: Ref?) {
x?.value = 0
}
fun IHost.test5(s: String?) = s?.extLength()
fun Int.foo() = 239
fun box() {
42?.foo()
}