Files
kotlin-fork/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt.txt
T
Vladimir Sukharev bae8b283c7 [IR] Normalize temp var names in Kotlin-like dump
^KT-61983 Fixed
2023-10-11 07:49:35 +00:00

68 lines
1.1 KiB
Kotlin
Vendored

package test
class C {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
var C?.p: Int
get(): Int {
return 42
}
set(value: Int) {
}
operator fun Int?.inc(): Int? {
return { // BLOCK
val tmp_0: Int? = <this>
when {
EQEQ(arg0 = tmp_0, arg1 = null) -> null
else -> tmp_0.inc()
}
}
}
operator fun Int?.get(index: Int): Int {
return 42
}
operator fun Int?.set(index: Int, value: Int) {
}
fun testProperty(nc: C?) {
{ // BLOCK
val tmp_1: C? = nc
when {
EQEQ(arg0 = tmp_1, arg1 = null) -> null
else -> { // BLOCK
val tmp_2: C? = tmp_1
{ // BLOCK
val tmp_3: Int = tmp_2.<get-p>()
tmp_2.<set-p>(value = tmp_3.inc())
tmp_3
}
}
}
} /*~> Unit */
}
fun testArrayAccess(nc: C?) {
{ // BLOCK
val tmp_4: Int? = { // BLOCK
val tmp_5: C? = nc
when {
EQEQ(arg0 = tmp_5, arg1 = null) -> null
else -> tmp_5.<get-p>()
}
}
val tmp_6: Int = 0
val tmp_7: Int = tmp_4.get(index = tmp_6)
tmp_4.set(index = tmp_6, value = tmp_7.inc())
tmp_7
} /*~> Unit */
}