Set correct IR origin for getting array element operators

^KT-60246: Fixed
This commit is contained in:
vladislav.grechko
2023-12-28 18:48:39 +01:00
committed by Space Team
parent 9aa8fb80e7
commit 3da1efc94a
14 changed files with 21 additions and 55 deletions
@@ -1,29 +0,0 @@
FILE fqName:<root> fileName:/arrayAccess.kt
PROPERTY name:p visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-p> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-p> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:test visibility:public modality:FINAL <> (a:kotlin.IntArray) returnType:kotlin.Int
VALUE_PARAMETER name:a index:0 type:kotlin.IntArray
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (a: kotlin.IntArray): kotlin.Int declared in <root>'
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun get (index: kotlin.Int): kotlin.Int declared in kotlin.IntArray' type=kotlin.Int origin=null
$this: GET_VAR 'a: kotlin.IntArray declared in <root>.test' type=kotlin.IntArray origin=null
index: CONST Int type=kotlin.Int value=0
other: CALL 'public final fun get (index: kotlin.Int): kotlin.Int declared in kotlin.IntArray' type=kotlin.Int origin=null
$this: GET_VAR 'a: kotlin.IntArray declared in <root>.test' type=kotlin.IntArray origin=null
index: CALL 'public final fun <get-p> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
other: CALL 'public final fun get (index: kotlin.Int): kotlin.Int declared in kotlin.IntArray' type=kotlin.Int origin=null
$this: GET_VAR 'a: kotlin.IntArray declared in <root>.test' type=kotlin.IntArray origin=null
index: CALL 'public final fun foo (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
@@ -1,11 +0,0 @@
val p: Int
field = 0
get
fun foo(): Int {
return 1
}
fun test(a: IntArray): Int {
return a.get(index = 0).plus(other = a.get(index = <get-p>())).plus(other = a.get(index = foo()))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
val p = 0
fun foo() = 1
@@ -37,7 +37,7 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Int declared in <root>.nsum'
CALL 'public abstract fun toInt (): kotlin.Int declared in kotlin.Number' type=kotlin.Int origin=null
$this: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.Number origin=null
$this: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.Number origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'args: kotlin.Array<out kotlin.Number> declared in <root>.nsum' type=kotlin.Array<out kotlin.Number> origin=null
index: GET_VAR 'it: kotlin.Int declared in <root>.nsum.<anonymous>' type=kotlin.Int origin=null
FUN name:zap visibility:public modality:FINAL <> (b:kotlin.Array<out kotlin.String>, k:kotlin.Int) returnType:kotlin.Unit
@@ -23,7 +23,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public open fun get (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
CALL 'public open fun get (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
@@ -4,11 +4,11 @@ FILE fqName:<root> fileName:/samOperators.kt
FUN name:test1 visibility:public modality:FINAL <> ($receiver:<root>.J) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:<root>.J
BLOCK_BODY
CALL 'public open fun get (k: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
CALL 'public open fun get (k: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=GET_ARRAY_ELEMENT
$this: GET_VAR '<this>: <root>.J declared in <root>.test1' type=<root>.J origin=null
k: TYPE_OP type=java.lang.Runnable origin=SAM_CONVERSION typeOperand=java.lang.Runnable
FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
CALL 'public open fun get (k: @[FlexibleNullability] java.lang.Runnable?, m: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
CALL 'public open fun get (k: @[FlexibleNullability] java.lang.Runnable?, m: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=GET_ARRAY_ELEMENT
$this: GET_VAR '<this>: <root>.J declared in <root>.test1' type=<root>.J origin=null
k: TYPE_OP type=java.lang.Runnable origin=SAM_CONVERSION typeOperand=java.lang.Runnable
FUNCTION_REFERENCE 'public final fun f (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>