Files
kotlin-fork/compiler/testData/ir/irText/expressions/safeCalls.kt.txt
T
2020-11-26 00:14:55 +03:00

86 lines
1.6 KiB
Plaintext
Vendored

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