[FIR] Unify some special names to make code more uniform
This commit is contained in:
Vendored
+1
-1
@@ -3,4 +3,4 @@ FIR element: FirFunctionCallImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
R|<local>/<<array>>|.R|SubstitutionOverride</MyMap.set: R|kotlin/Unit|>|(R|<local>/<<index_0>>|, R|<local>/<<array>>|.R|SubstitutionOverride</MyMap.get: R|kotlin/Int|>|(R|<local>/<<index_0>>|).R|kotlin/Int.plus|(Int(1)))
|
||||
R|<local>/<array>|.R|SubstitutionOverride</MyMap.set: R|kotlin/Unit|>|(R|<local>/<index_0>|, R|<local>/<array>|.R|SubstitutionOverride</MyMap.get: R|kotlin/Int|>|(R|<local>/<index_0>|).R|kotlin/Int.plus|(Int(1)))
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ FIR element: FirFunctionCallImpl
|
||||
FIR source kind: DesugaredCompoundAssignment
|
||||
|
||||
FIR element rendered:
|
||||
R|<local>/<<array>>|.R|SubstitutionOverride</MyMap.get: R|kotlin/Int|>|(R|<local>/<<index_0>>|)
|
||||
R|<local>/<array>|.R|SubstitutionOverride</MyMap.get: R|kotlin/Int|>|(R|<local>/<index_0>|)
|
||||
+3
-3
@@ -49,9 +49,9 @@ FILE: arraySetWithOperation.kt
|
||||
}
|
||||
public final fun test_2(a: R|A<C>|): R|kotlin/Unit| {
|
||||
{
|
||||
lval <<array>>: R|A<C>| = R|<local>/a|
|
||||
lval <<index_0>>: R|kotlin/Int| = Int(0)
|
||||
R|<local>/<<array>>|.R|SubstitutionOverride</A.set: R|kotlin/Unit|>|(R|<local>/<<index_0>>|, R|<local>/<<array>>|.R|SubstitutionOverride</A.get: R|C|>|(R|<local>/<<index_0>>|).R|/C.plus|(R|/C.C|()))
|
||||
lval <array>: R|A<C>| = R|<local>/a|
|
||||
lval <index_0>: R|kotlin/Int| = Int(0)
|
||||
R|<local>/<array>|.R|SubstitutionOverride</A.set: R|kotlin/Unit|>|(R|<local>/<index_0>|, R|<local>/<array>|.R|SubstitutionOverride</A.get: R|C|>|(R|<local>/<index_0>|).R|/C.plus|(R|/C.C|()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-10
@@ -174,18 +174,18 @@ FILE: arraySetWithPlusAssign.kt
|
||||
}
|
||||
public final fun test_7(x: R|G|): R|kotlin/Unit| {
|
||||
{
|
||||
lval <<array>>: R|G| = R|<local>/x|
|
||||
lval <<index_0>>: R|kotlin/Int| = Int(1)
|
||||
lval <<index_1>>: R|kotlin/Int| = Int(2)
|
||||
lval <<index_2>>: R|kotlin/Int| = Int(3)
|
||||
R|<local>/<<array>>|.R|/G.set|(R|<local>/<<index_0>>|, R|<local>/<<index_1>>|, R|<local>/<<index_2>>|, R|<local>/<<array>>|.R|/G.get|(R|<local>/<<index_0>>|, R|<local>/<<index_1>>|, R|<local>/<<index_2>>|).R|/G.plus|(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
lval <array>: R|G| = R|<local>/x|
|
||||
lval <index_0>: R|kotlin/Int| = Int(1)
|
||||
lval <index_1>: R|kotlin/Int| = Int(2)
|
||||
lval <index_2>: R|kotlin/Int| = Int(3)
|
||||
R|<local>/<array>|.R|/G.set|(R|<local>/<index_0>|, R|<local>/<index_1>|, R|<local>/<index_2>|, R|<local>/<array>|.R|/G.get|(R|<local>/<index_0>|, R|<local>/<index_1>|, R|<local>/<index_2>|).R|/G.plus|(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|/someCallInsideLambda|()
|
||||
{
|
||||
lval <<array>>: R|G| = R|<local>/x|
|
||||
lval <<index_0>>: R|kotlin/Int| = Int(1)
|
||||
lval <<index_1>>: R|kotlin/Int| = Int(2)
|
||||
lval <<index_2>>: R|kotlin/Int| = Int(3)
|
||||
R|<local>/<<array>>|.R|/G.set|(R|<local>/<<index_0>>|, R|<local>/<<index_1>>|, R|<local>/<<index_2>>|, R|<local>/<<array>>|.R|/G.get|(R|<local>/<<index_0>>|, R|<local>/<<index_1>>|, R|<local>/<<index_2>>|).R|/G.plus|(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
lval <array>: R|G| = R|<local>/x|
|
||||
lval <index_0>: R|kotlin/Int| = Int(1)
|
||||
lval <index_1>: R|kotlin/Int| = Int(2)
|
||||
lval <index_2>: R|kotlin/Int| = Int(3)
|
||||
R|<local>/<array>|.R|/G.set|(R|<local>/<index_0>|, R|<local>/<index_1>|, R|<local>/<index_2>|, R|<local>/<array>|.R|/G.get|(R|<local>/<index_0>|, R|<local>/<index_1>|, R|<local>/<index_2>|).R|/G.plus|(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|/someCallInsideLambda|()
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ fun FirClass.findNonInterfaceSupertype(context: CheckerContext): FirTypeRef? {
|
||||
}
|
||||
|
||||
val FirFunctionCall.isIterator: Boolean
|
||||
get() = this.calleeReference.name.asString() == "<iterator>"
|
||||
get() = this.calleeReference.name == SpecialNames.ITERATOR
|
||||
|
||||
fun ConeKotlinType.isSubtypeOfThrowable(session: FirSession): Boolean =
|
||||
session.builtinTypes.throwableType.type.isSupertypeOf(session.typeContext, this.fullyExpandedType(session))
|
||||
|
||||
Vendored
+36
-36
@@ -20,45 +20,45 @@ FILE: safeCallsWithUnaryOperators.kt
|
||||
R|<local>/<unary>|
|
||||
a#?.{ {
|
||||
lval <array>: <implicit> = $subj$.b#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
}
|
||||
a#?.{ $subj$.b# }?.{ {
|
||||
lval <array>: <implicit> = $subj$.c#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
}
|
||||
lval <array>: <implicit> = a#?.{ $subj$.b# }.c#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
a#?.{ {
|
||||
lval <array>: <implicit> = $subj$.b#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
}
|
||||
a#?.{ $subj$.b# }?.{ {
|
||||
lval <array>: <implicit> = $subj$.c#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
}
|
||||
lval <array>: <implicit> = a#?.{ $subj$.b# }.c#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
lval <receiver>: <implicit> = a#?.{ $subj$.b# }
|
||||
lval <unary>: <implicit> = R|<local>/<receiver>|.d#()
|
||||
@@ -86,45 +86,45 @@ FILE: safeCallsWithUnaryOperators.kt
|
||||
R|<local>/<unary-result>|
|
||||
a#?.{ {
|
||||
lval <array>: <implicit> = $subj$.b#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
}
|
||||
a#?.{ $subj$.b# }?.{ {
|
||||
lval <array>: <implicit> = $subj$.c#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
}
|
||||
lval <array>: <implicit> = a#?.{ $subj$.b# }.c#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
a#?.{ {
|
||||
lval <array>: <implicit> = $subj$.b#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
}
|
||||
a#?.{ $subj$.b# }?.{ {
|
||||
lval <array>: <implicit> = $subj$.c#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
}
|
||||
lval <array>: <implicit> = a#?.{ $subj$.b# }.c#.get#(IntegerLiteral(0))
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
lval <receiver>: <implicit> = a#?.{ $subj$.b# }
|
||||
lval <unary-result>: <implicit> = R|<local>/<receiver>|.d#().inc#()
|
||||
|
||||
@@ -58,17 +58,17 @@ FILE: unary.kt
|
||||
public? final? fun test3(arr: Array<Int>): R|kotlin/Unit| {
|
||||
lval x1: <implicit> = {
|
||||
lval <array>: <implicit> = arr#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
lval x2: <implicit> = {
|
||||
lval <array>: <implicit> = arr#
|
||||
lval <index0>: <implicit> = IntegerLiteral(1)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(1)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
|
||||
@@ -85,17 +85,17 @@ FILE: unary.kt
|
||||
public? final? fun test4(y: Y): R|kotlin/Unit| {
|
||||
lval x1: <implicit> = {
|
||||
lval <array>: <implicit> = y#.arr#
|
||||
lval <index0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary>|.inc#())
|
||||
lval <index_0>: <implicit> = IntegerLiteral(0)
|
||||
lval <unary>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary>|.inc#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
lval x2: <implicit> = {
|
||||
lval <array>: <implicit> = y#.arr#
|
||||
lval <index0>: <implicit> = IntegerLiteral(1)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index0>|, R|<local>/<unary-result>|)
|
||||
lval <index_0>: <implicit> = IntegerLiteral(1)
|
||||
lval <unary-result>: <implicit> = R|<local>/<array>|.get#(R|<local>/<index_0>|).inc#()
|
||||
R|<local>/<array>|.set#(R|<local>/<index_0>|, R|<local>/<unary-result>|)
|
||||
R|<local>/<unary-result>|
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -715,7 +715,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
val argumentReceiverVariable = generateTemporaryVariable(
|
||||
baseModuleData,
|
||||
argumentReceiver?.toFirSourceElement(),
|
||||
Name.special("<receiver>"),
|
||||
SpecialNames.RECEIVER,
|
||||
initializer = receiverFir,
|
||||
).also { statements += it }
|
||||
|
||||
@@ -795,7 +795,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
val arrayVariable = generateTemporaryVariable(
|
||||
baseModuleData,
|
||||
array?.toFirSourceElement(),
|
||||
Name.special("<array>"),
|
||||
name = SpecialNames.ARRAY,
|
||||
initializer = arrayReceiver,
|
||||
).also { statements += it }
|
||||
|
||||
@@ -803,7 +803,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
generateTemporaryVariable(
|
||||
baseModuleData,
|
||||
index.toFirSourceElement(),
|
||||
Name.special("<index$i>"),
|
||||
name = SpecialNames.subscribeOperatorIndex(i),
|
||||
index.convert()
|
||||
).also { statements += it }
|
||||
}
|
||||
|
||||
+3
-2
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||
import org.jetbrains.kotlin.fir.visitors.TransformData
|
||||
import org.jetbrains.kotlin.fir.visitors.transformSingle
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.buildAbstractResultingSubstitutor
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
@@ -1304,7 +1305,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
val arrayVariable = generateTemporaryVariable(
|
||||
session.moduleData,
|
||||
source = lhsGetCall.explicitReceiver?.source?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment),
|
||||
specialName = "<array>",
|
||||
name = SpecialNames.ARRAY,
|
||||
initializer = lhsGetCall.explicitReceiver ?: buildErrorExpression {
|
||||
source = augmentedArraySetCall.source
|
||||
?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment)
|
||||
@@ -1321,7 +1322,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
generateTemporaryVariable(
|
||||
session.moduleData,
|
||||
source = index.source?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment),
|
||||
specialName = "<index_$i>",
|
||||
name = SpecialNames.subscribeOperatorIndex(i),
|
||||
initializer = index
|
||||
)
|
||||
}
|
||||
|
||||
+9
-9
@@ -22,24 +22,24 @@ class C {
|
||||
fun testVariable() {
|
||||
var x: IntArray = foo()
|
||||
{ // BLOCK
|
||||
val <<array>>: IntArray = x
|
||||
val <<index_0>>: Int = 0
|
||||
<<array>>.set(index = <<index_0>>, value = <<array>>.get(index = <<index_0>>).plus(other = 1))
|
||||
val <array>: IntArray = x
|
||||
val <index_0>: Int = 0
|
||||
<array>.set(index = <index_0>, value = <array>.get(index = <index_0>).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
fun testCall() {
|
||||
{ // BLOCK
|
||||
val <<array>>: IntArray = foo()
|
||||
val <<index_0>>: Int = bar()
|
||||
<<array>>.set(index = <<index_0>>, value = <<array>>.get(index = <<index_0>>).times(other = 2))
|
||||
val <array>: IntArray = foo()
|
||||
val <index_0>: Int = bar()
|
||||
<array>.set(index = <index_0>, value = <array>.get(index = <index_0>).times(other = 2))
|
||||
}
|
||||
}
|
||||
|
||||
fun testMember(c: C) {
|
||||
val <array>: IntArray = c.<get-x>()
|
||||
val <index0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.inc())
|
||||
val <index_0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.inc())
|
||||
<unary> /*~> Unit */
|
||||
}
|
||||
|
||||
+3
-3
@@ -10,8 +10,8 @@ interface IB {
|
||||
|
||||
fun IB.test(a: IA) {
|
||||
{ // BLOCK
|
||||
val <<array>>: IA = a
|
||||
val <<index_0>>: String = ""
|
||||
(<this>, <<array>>).set(index = <<index_0>>, value = <<array>>.get(index = <<index_0>>).plus(other = 42))
|
||||
val <array>: IA = a
|
||||
val <index_0>: String = ""
|
||||
(<this>, <array>).set(index = <index_0>, value = <array>.get(index = <index_0>).plus(other = 42))
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+18
-18
@@ -45,40 +45,40 @@ fun withVararg(vararg xs: Int): Int {
|
||||
|
||||
fun test1() {
|
||||
{ // BLOCK
|
||||
val <<array>>: A = A
|
||||
val <<index_0>>: KFunction1<Int, Unit> = local fun withVararg(p0: Int) {
|
||||
val <array>: A = A
|
||||
val <index_0>: KFunction1<Int, Unit> = local fun withVararg(p0: Int) {
|
||||
withVararg(xs = [p0])
|
||||
}
|
||||
|
||||
<<array>>.set(i = <<index_0>> /*-> IFoo */, newValue = <<array>>.get(i = <<index_0>> /*-> IFoo */).plus(other = 1))
|
||||
<array>.set(i = <index_0> /*-> IFoo */, newValue = <array>.get(i = <index_0> /*-> IFoo */).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
{ // BLOCK
|
||||
val <<array>>: B = B
|
||||
val <<index_0>>: KFunction1<Int, Unit> = local fun withVararg(p0: Int) {
|
||||
val <array>: B = B
|
||||
val <index_0>: KFunction1<Int, Unit> = local fun withVararg(p0: Int) {
|
||||
withVararg(xs = [p0])
|
||||
}
|
||||
|
||||
<<array>>.set(i = <<index_0>> /*-> IFoo2 */, newValue = <<array>>.get(i = <<index_0>> /*-> IFoo */).plus(other = 1))
|
||||
<array>.set(i = <index_0> /*-> IFoo2 */, newValue = <array>.get(i = <index_0> /*-> IFoo */).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(fn: Function1<Int, Unit>) {
|
||||
{ // BLOCK
|
||||
val <<array>>: A = A
|
||||
val <<index_0>>: Function1<Int, Unit> = fn
|
||||
<<array>>.set(i = <<index_0>> /*-> IFoo */, newValue = <<array>>.get(i = <<index_0>> /*-> IFoo */).plus(other = 1))
|
||||
val <array>: A = A
|
||||
val <index_0>: Function1<Int, Unit> = fn
|
||||
<array>.set(i = <index_0> /*-> IFoo */, newValue = <array>.get(i = <index_0> /*-> IFoo */).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
fun test4(fn: Function1<Int, Unit>) {
|
||||
when {
|
||||
fn is IFoo -> { // BLOCK
|
||||
val <<array>>: A = A
|
||||
val <<index_0>>: IFoo = fn /*as IFoo */
|
||||
<<array>>.set(i = <<index_0>>, newValue = <<array>>.get(i = <<index_0>>).plus(other = 1))
|
||||
val <array>: A = A
|
||||
val <index_0>: IFoo = fn /*as IFoo */
|
||||
<array>.set(i = <index_0>, newValue = <array>.get(i = <index_0>).plus(other = 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,9 +86,9 @@ fun test4(fn: Function1<Int, Unit>) {
|
||||
fun test5(a: Any) {
|
||||
a as Function1<Int, Unit> /*~> Unit */
|
||||
{ // BLOCK
|
||||
val <<array>>: A = A
|
||||
val <<index_0>>: Function1<Int, Unit> = a /*as Function1<Int, Unit> */
|
||||
<<array>>.set(i = <<index_0>> /*-> IFoo */, newValue = <<array>>.get(i = <<index_0>> /*-> IFoo */).plus(other = 1))
|
||||
val <array>: A = A
|
||||
val <index_0>: Function1<Int, Unit> = a /*as Function1<Int, Unit> */
|
||||
<array>.set(i = <index_0> /*-> IFoo */, newValue = <array>.get(i = <index_0> /*-> IFoo */).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ fun test6(a: Any) {
|
||||
a as Function1<Int, Unit> /*~> Unit */
|
||||
a /*as Function1<Int, Unit> */ as IFoo /*~> Unit */
|
||||
{ // BLOCK
|
||||
val <<array>>: A = A
|
||||
val <<index_0>>: Function1<Int, Unit> = a /*as Function1<Int, Unit> */
|
||||
<<array>>.set(i = <<index_0>>, newValue = <<array>>.get(i = <<index_0>>).plus(other = 1))
|
||||
val <array>: A = A
|
||||
val <index_0>: Function1<Int, Unit> = a /*as Function1<Int, Unit> */
|
||||
<array>.set(i = <index_0>, newValue = <array>.get(i = <index_0>).plus(other = 1))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -43,13 +43,13 @@ object X1 {
|
||||
fun test1(a: IntArray) {
|
||||
var i: Int = 0
|
||||
val <array>: IntArray = a
|
||||
val <index0>: Int = { // BLOCK
|
||||
val <index_0>: Int = { // BLOCK
|
||||
val <unary>: Int = i
|
||||
i = <unary>.inc()
|
||||
<unary>
|
||||
}
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.inc())
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.inc())
|
||||
<unary> /*~> Unit */
|
||||
}
|
||||
|
||||
|
||||
@@ -59,16 +59,16 @@ fun testPropPostfix() {
|
||||
fun testArrayPrefix() {
|
||||
val a1: Int = { // BLOCK
|
||||
val <array>: IntArray = <get-arr>()
|
||||
val <index0>: Int = 0
|
||||
val <unary-result>: Int = <array>.get(index = <index0>).inc()
|
||||
<array>.set(index = <index0>, value = <unary-result>)
|
||||
val <index_0>: Int = 0
|
||||
val <unary-result>: Int = <array>.get(index = <index_0>).inc()
|
||||
<array>.set(index = <index_0>, value = <unary-result>)
|
||||
<unary-result>
|
||||
}
|
||||
val a2: Int = { // BLOCK
|
||||
val <array>: IntArray = <get-arr>()
|
||||
val <index0>: Int = 0
|
||||
val <unary-result>: Int = <array>.get(index = <index0>).dec()
|
||||
<array>.set(index = <index0>, value = <unary-result>)
|
||||
val <index_0>: Int = 0
|
||||
val <unary-result>: Int = <array>.get(index = <index_0>).dec()
|
||||
<array>.set(index = <index_0>, value = <unary-result>)
|
||||
<unary-result>
|
||||
}
|
||||
}
|
||||
@@ -76,16 +76,16 @@ fun testArrayPrefix() {
|
||||
fun testArrayPostfix() {
|
||||
val a1: Int = { // BLOCK
|
||||
val <array>: IntArray = <get-arr>()
|
||||
val <index0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.inc())
|
||||
val <index_0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.inc())
|
||||
<unary>
|
||||
}
|
||||
val a2: Int = { // BLOCK
|
||||
val <array>: IntArray = <get-arr>()
|
||||
val <index0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.dec())
|
||||
val <index_0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.dec())
|
||||
<unary>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,19 @@ fun testSimpleAssignment(a: A) {
|
||||
fun testPostfixIncrement(a: A): Int {
|
||||
return { // BLOCK
|
||||
val <array>: A = a
|
||||
val <index0>: Int = 1
|
||||
val <index1>: Int = 2
|
||||
val <unary>: Int = <array>.get(xs = [<index0>, <index1>])
|
||||
<array>.set(i = <index0>, j = <index1>, v = <unary>.inc())
|
||||
val <index_0>: Int = 1
|
||||
val <index_1>: Int = 2
|
||||
val <unary>: Int = <array>.get(xs = [<index_0>, <index_1>])
|
||||
<array>.set(i = <index_0>, j = <index_1>, v = <unary>.inc())
|
||||
<unary>
|
||||
}
|
||||
}
|
||||
|
||||
fun testCompoundAssignment(a: A) {
|
||||
{ // BLOCK
|
||||
val <<array>>: A = a
|
||||
val <<index_0>>: Int = 1
|
||||
val <<index_1>>: Int = 2
|
||||
<<array>>.set(i = <<index_0>>, j = <<index_1>>, v = <<array>>.get(xs = [<<index_0>>, <<index_1>>]).plus(other = 10))
|
||||
val <array>: A = a
|
||||
val <index_0>: Int = 1
|
||||
val <index_1>: Int = 2
|
||||
<array>.set(i = <index_0>, j = <index_1>, v = <array>.get(xs = [<index_0>, <index_1>]).plus(other = 10))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ fun testSimpleAssignment(a: A) {
|
||||
fun testPostfixIncrement(a: A): Int {
|
||||
return { // BLOCK
|
||||
val <array>: A = a
|
||||
val <index0>: Int = 1
|
||||
val <unary>: Int = <array>.get(i = <index0>)
|
||||
<array>.set(i = <index0>, v = <unary>.inc())
|
||||
val <index_0>: Int = 1
|
||||
val <unary>: Int = <array>.get(i = <index_0>)
|
||||
<array>.set(i = <index_0>, v = <unary>.inc())
|
||||
<unary>
|
||||
}
|
||||
}
|
||||
|
||||
fun testCompoundAssignment(a: A) {
|
||||
{ // BLOCK
|
||||
val <<array>>: A = a
|
||||
val <<index_0>>: Int = 1
|
||||
<<array>>.set(i = <<index_0>>, v = <<array>>.get(i = <<index_0>>).plus(other = 10))
|
||||
val <array>: A = a
|
||||
val <index_0>: Int = 1
|
||||
<array>.set(i = <index_0>, v = <array>.get(i = <index_0>).plus(other = 10))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ val aFloat: A<Float>
|
||||
val aInt: Float
|
||||
field = { // BLOCK
|
||||
val <array>: A<Float> = <get-aFloat>()
|
||||
val <index0>: Int = 1
|
||||
val <unary>: Float = <array>.get(i = <index0>)
|
||||
<array>.set(i = <index0>, v = <unary>.dec())
|
||||
val <index_0>: Int = 1
|
||||
val <unary>: Float = <array>.get(i = <index_0>)
|
||||
<array>.set(i = <index_0>, v = <unary>.dec())
|
||||
<unary>
|
||||
}
|
||||
get
|
||||
|
||||
@@ -17,22 +17,22 @@ fun test1(a: Any) {
|
||||
|
||||
fun test2(a: Any) {
|
||||
{ // BLOCK
|
||||
val <<array>>: Any = a
|
||||
val <<index_0>>: Function0<Unit> = local fun <anonymous>() {
|
||||
val <array>: Any = a
|
||||
val <index_0>: Function0<Unit> = local fun <anonymous>() {
|
||||
return Unit
|
||||
}
|
||||
|
||||
<<array>>.set(index = <<index_0>>, value = <<array>>.get(index = <<index_0>>).plus(other = 42))
|
||||
<array>.set(index = <index_0>, value = <array>.get(index = <index_0>).plus(other = 42))
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(a: Any) {
|
||||
val <array>: Any = a
|
||||
val <index0>: Function0<Unit> = local fun <anonymous>() {
|
||||
val <index_0>: Function0<Unit> = local fun <anonymous>() {
|
||||
return Unit
|
||||
}
|
||||
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.inc())
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.inc())
|
||||
<unary> /*~> Unit */
|
||||
}
|
||||
|
||||
+3
-3
@@ -55,9 +55,9 @@ fun testArrayAccess(nc: C?) {
|
||||
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
|
||||
else -> { // BLOCK
|
||||
val <array>: Int = tmp2_safe_receiver.<get-p>()
|
||||
val <index0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index0>)
|
||||
<array>.set(index = <index0>, value = <unary>.inc())
|
||||
val <index_0>: Int = 0
|
||||
val <unary>: Int = <array>.get(index = <index_0>)
|
||||
<array>.set(index = <index_0>, value = <unary>.inc())
|
||||
<unary>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,24 @@ object SpecialNames {
|
||||
@JvmField
|
||||
val IMPLICIT_SET_PARAMETER = Name.special("<set-?>")
|
||||
|
||||
@JvmField
|
||||
val ARRAY = Name.special("<array>")
|
||||
|
||||
@JvmField
|
||||
val RECEIVER = Name.special("<receiver>")
|
||||
|
||||
/**
|
||||
* Special name to store expressions used as indexes in subscription operators (`get` and `set`).
|
||||
*
|
||||
* For example, `bar1()` and `bar2()` are indexes in `foo[bar1(), bar2()]` call.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun subscribeOperatorIndex(idx: Int): Name {
|
||||
require(idx >= 0) { "Index should be non-negative, but was $idx" }
|
||||
|
||||
return Name.special("<index_$idx>")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun safeIdentifier(name: Name?): Name {
|
||||
return if (name != null && !name.isSpecial) name else SAFE_IDENTIFIER_FOR_NO_NAME
|
||||
|
||||
Reference in New Issue
Block a user