Files
kotlin-fork/compiler/testData/ir/irText/expressions/safeCalls.fir.kt.txt
T
2024-02-16 10:19:38 +00:00

86 lines
1.3 KiB
Kotlin
Vendored

class Ref {
var value: Int
field = value
get
set
constructor(value: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
}
interface IHost {
fun String.extLength(): Int {
return <this>.<get-length>()
}
}
fun box() {
{ // BLOCK
val tmp_0: Int = 42
when {
EQEQ(arg0 = tmp_0, arg1 = null) -> null
else -> tmp_0.foo()
}
} /*~> Unit */
}
fun Int.foo(): Int {
return 239
}
fun test1(x: String?): Int? {
return { // BLOCK
val tmp_1: String? = x
when {
EQEQ(arg0 = tmp_1, arg1 = null) -> null
else -> tmp_1.<get-length>()
}
}
}
fun test2(x: String?): Int? {
return { // BLOCK
val tmp_2: String? = x
when {
EQEQ(arg0 = tmp_2, arg1 = null) -> null
else -> tmp_2.hashCode()
}
}
}
fun test3(x: String?, y: Any?): Boolean? {
return { // BLOCK
val tmp_3: String? = x
when {
EQEQ(arg0 = tmp_3, arg1 = null) -> null
else -> tmp_3.equals(other = y)
}
}
}
fun test4(x: Ref?) {
{ // BLOCK
val tmp_4: Ref? = x
when {
EQEQ(arg0 = tmp_4, arg1 = null) -> null
else -> tmp_4.<set-value>(<set-?> = 0)
}
} /*~> Unit */
}
fun IHost.test5(s: String?): Int? {
return { // BLOCK
val tmp_5: String? = s
when {
EQEQ(arg0 = tmp_5, arg1 = null) -> null
else -> (<this>, tmp_5).extLength()
}
}
}