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

67 lines
1.1 KiB
Kotlin
Vendored

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