Set correct IR origins for inc/dec operations

NB: in order to produce correct IR origins, the source element kinds for
some FIR elements has been changed. As a side effect, mapping PSI to FIR
slightly changed: namely, for `a[b]++`, `a[b]` used to be mapped on
`set` call or callable reference, but now it is mapped on `get` call.

^KT-61891: Fixed
^KT-64387: Fixed
This commit is contained in:
vladislav.grechko
2023-12-28 17:12:17 +01:00
committed by Space Team
parent 8b1d87848d
commit 9aa8fb80e7
65 changed files with 463 additions and 972 deletions
@@ -1,16 +0,0 @@
FILE fqName:<root> fileName:/localFunction.kt
FUN name:outer visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:x type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
FUN LOCAL_FUNCTION name:local visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.outer' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.outer' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.outer.local' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.outer.local' type=kotlin.Int origin=null
CALL 'local final fun local (): kotlin.Unit declared in <root>.outer' type=kotlin.Unit origin=null
@@ -1,13 +0,0 @@
fun outer() {
var x: Int = 0
local fun local() {
{ // BLOCK
val tmp_0: Int = x
x = tmp_0.inc()
tmp_0
} /*~> Unit */
}
local()
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun outer() {
var x = 0
fun local() { x++ }