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:
committed by
Space Team
parent
8b1d87848d
commit
9aa8fb80e7
@@ -1,38 +0,0 @@
|
||||
FILE fqName:<root> fileName:/coercionInLoop.kt
|
||||
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
VAR name:a type:kotlin.DoubleArray [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (size: kotlin.Int) declared in kotlin.DoubleArray' type=kotlin.DoubleArray origin=null
|
||||
size: CONST Int type=kotlin.Int value=5
|
||||
VAR name:x type:kotlin.collections.DoubleIterator [val]
|
||||
CALL 'public final fun iterator (): kotlin.collections.DoubleIterator declared in kotlin.DoubleArray' type=kotlin.collections.DoubleIterator origin=null
|
||||
$this: GET_VAR 'val a: kotlin.DoubleArray declared in <root>.box' type=kotlin.DoubleArray origin=null
|
||||
VAR name:i type:kotlin.Int [var]
|
||||
CONST Int type=kotlin.Int value=0
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.DoubleIterator' type=kotlin.Boolean origin=null
|
||||
$this: GET_VAR 'val x: kotlin.collections.DoubleIterator declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
|
||||
$this: CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
|
||||
arg0: CALL 'public final fun get (index: kotlin.Int): kotlin.Double declared in kotlin.DoubleArray' type=kotlin.Double origin=null
|
||||
$this: GET_VAR 'val a: kotlin.DoubleArray declared in <root>.box' type=kotlin.DoubleArray origin=null
|
||||
index: GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||
arg1: CALL 'public final fun next (): kotlin.Double declared in kotlin.collections.DoubleIterator' type=kotlin.Double origin=null
|
||||
$this: GET_VAR 'val x: kotlin.collections.DoubleIterator declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null
|
||||
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
CONST String type=kotlin.String value="Fail "
|
||||
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||
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 i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||
SET_VAR 'var i: kotlin.Int declared in <root>.box' 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>.box' type=kotlin.Int origin=null
|
||||
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
CONST String type=kotlin.String value="OK"
|
||||
@@ -1,17 +0,0 @@
|
||||
fun box(): String {
|
||||
val a: DoubleArray = DoubleArray(size = 5)
|
||||
val x: DoubleIterator = a.iterator()
|
||||
var i: Int = 0
|
||||
while (x.hasNext()) { // BLOCK
|
||||
when {
|
||||
ieee754equals(arg0 = a.get(index = i), arg1 = x.next()).not() -> return "Fail " + i
|
||||
}
|
||||
{ // BLOCK
|
||||
val tmp_0: Int = i
|
||||
i = tmp_0.inc()
|
||||
tmp_0
|
||||
} /*~> Unit */
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun box(): String {
|
||||
val a = DoubleArray(5)
|
||||
val x = a.iterator()
|
||||
|
||||
Reference in New Issue
Block a user