[FIR] Insert fake source for FIR for array access temporaries

This commit is contained in:
Kristoffer Andersen
2022-09-23 17:58:04 +02:00
committed by Ilya Kirillov
parent 46feb00ee7
commit fcabc60471
11 changed files with 104 additions and 1 deletions
@@ -0,0 +1,8 @@
interface MyMap<K, V> {
operator fun get(k: K): V
operator fun set(k: K, v: V)
}
fun test(m: MyMap<String, Int>) {
<expr>m</expr>["a"] += 1
}
@@ -0,0 +1,6 @@
KT element: KtNameReferenceExpression
FIR element: FirPropertyAccessExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
R|<local>/m|
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
interface A {
operator fun inc(): A
}
interface MyMap<K, V> {
operator fun get(k: K): V
operator fun set(k: K, v: V): Unit
}
fun test(m: MyMap<String, A>) {
<expr>m["a"]++</expr>
}
@@ -0,0 +1,6 @@
KT element: KtPostfixExpression
FIR element: FirFunctionCallImpl
FIR source kind: DesugaredIncrementOrDecrement
FIR element rendered:
R|<local>/<array>|.R|SubstitutionOverride</MyMap.set: R|kotlin/Unit|>|(R|<local>/<index_0>|, R|<local>/<unary>|.R|/A.inc|())
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
interface A {
operator fun inc(): A
}
interface MyMap<K, V> {
operator fun get(k: K): V
operator fun set(k: K, v: V): Unit
}
fun test(m: MyMap<String, A>) {
<expr>m</expr>["a"]++
}
@@ -0,0 +1,6 @@
KT element: KtNameReferenceExpression
FIR element: FirPropertyAccessExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
R|<local>/m|
@@ -0,0 +1,12 @@
interface A {
operator fun inc(): A
}
interface MyMap<K, V> {
operator fun get(k: K): V
operator fun set(k: K, v: V): Unit
}
fun test(m: MyMap<String, A>) {
<expr>m["a"]</expr>++
}
@@ -0,0 +1,6 @@
KT element: KtArrayAccessExpression
FIR element: FirResolvedNamedReferenceImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
R|SubstitutionOverride</MyMap.set: R|kotlin/Unit|>|