diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention.txt index 4bf2988de44..7f5dfd489e5 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention.txt @@ -3,4 +3,4 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|/<>|.R|SubstitutionOverride|(R|/<>|, R|/<>|.R|SubstitutionOverride|(R|/<>|).R|kotlin/Int.plus|(Int(1))) +R|/|.R|SubstitutionOverride|(R|/|, R|/|.R|SubstitutionOverride|(R|/|).R|kotlin/Int.plus|(Int(1))) diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_lhs.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_lhs.txt index 974e4776097..afa55097e1e 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_lhs.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_lhs.txt @@ -3,4 +3,4 @@ FIR element: FirFunctionCallImpl FIR source kind: DesugaredCompoundAssignment FIR element rendered: -R|/<>|.R|SubstitutionOverride|(R|/<>|) \ No newline at end of file +R|/|.R|SubstitutionOverride|(R|/|) \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/arrays/arraySetWithOperation.fir.txt b/compiler/fir/analysis-tests/testData/resolve/arrays/arraySetWithOperation.fir.txt index a77bde54efe..0dac396614f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arrays/arraySetWithOperation.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/arrays/arraySetWithOperation.fir.txt @@ -49,9 +49,9 @@ FILE: arraySetWithOperation.kt } public final fun test_2(a: R|A|): R|kotlin/Unit| { { - lval <>: R|A| = R|/a| - lval <>: R|kotlin/Int| = Int(0) - R|/<>|.R|SubstitutionOverride|(R|/<>|, R|/<>|.R|SubstitutionOverride|(R|/<>|).R|/C.plus|(R|/C.C|())) + lval : R|A| = R|/a| + lval : R|kotlin/Int| = Int(0) + R|/|.R|SubstitutionOverride|(R|/|, R|/|.R|SubstitutionOverride|(R|/|).R|/C.plus|(R|/C.C|())) } } diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.fir.txt b/compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.fir.txt index 924d225c2e7..d4783ae2e20 100644 --- a/compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/arraySetWithPlusAssign.fir.txt @@ -174,18 +174,18 @@ FILE: arraySetWithPlusAssign.kt } public final fun test_7(x: R|G|): R|kotlin/Unit| { { - lval <>: R|G| = R|/x| - lval <>: R|kotlin/Int| = Int(1) - lval <>: R|kotlin/Int| = Int(2) - lval <>: R|kotlin/Int| = Int(3) - R|/<>|.R|/G.set|(R|/<>|, R|/<>|, R|/<>|, R|/<>|.R|/G.get|(R|/<>|, R|/<>|, R|/<>|).R|/G.plus|(fun (): R|kotlin/Unit| { + lval : R|G| = R|/x| + lval : R|kotlin/Int| = Int(1) + lval : R|kotlin/Int| = Int(2) + lval : R|kotlin/Int| = Int(3) + R|/|.R|/G.set|(R|/|, R|/|, R|/|, R|/|.R|/G.get|(R|/|, R|/|, R|/|).R|/G.plus|(fun (): R|kotlin/Unit| { R|/someCallInsideLambda|() { - lval <>: R|G| = R|/x| - lval <>: R|kotlin/Int| = Int(1) - lval <>: R|kotlin/Int| = Int(2) - lval <>: R|kotlin/Int| = Int(3) - R|/<>|.R|/G.set|(R|/<>|, R|/<>|, R|/<>|, R|/<>|.R|/G.get|(R|/<>|, R|/<>|, R|/<>|).R|/G.plus|(fun (): R|kotlin/Unit| { + lval : R|G| = R|/x| + lval : R|kotlin/Int| = Int(1) + lval : R|kotlin/Int| = Int(2) + lval : R|kotlin/Int| = Int(3) + R|/|.R|/G.set|(R|/|, R|/|, R|/|, R|/|.R|/G.get|(R|/|, R|/|, R|/|).R|/G.plus|(fun (): R|kotlin/Unit| { R|/someCallInsideLambda|() Q|kotlin/Unit| } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index 6eed552075f..50f50c637c4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -255,7 +255,7 @@ fun FirClass.findNonInterfaceSupertype(context: CheckerContext): FirTypeRef? { } val FirFunctionCall.isIterator: Boolean - get() = this.calleeReference.name.asString() == "" + get() = this.calleeReference.name == SpecialNames.ITERATOR fun ConeKotlinType.isSubtypeOfThrowable(session: FirSession): Boolean = session.builtinTypes.throwableType.type.isSupertypeOf(session.typeContext, this.fullyExpandedType(session)) diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt index da890c8b285..85221854513 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt @@ -20,45 +20,45 @@ FILE: safeCallsWithUnaryOperators.kt R|/| a#?.{ { lval : = $subj$.b# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } } a#?.{ $subj$.b# }?.{ { lval : = $subj$.c# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } } lval : = a#?.{ $subj$.b# }.c# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| a#?.{ { lval : = $subj$.b#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } } a#?.{ $subj$.b# }?.{ { lval : = $subj$.c#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } } lval : = a#?.{ $subj$.b# }.c#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| lval : = a#?.{ $subj$.b# } lval : = R|/|.d#() @@ -86,45 +86,45 @@ FILE: safeCallsWithUnaryOperators.kt R|/| a#?.{ { lval : = $subj$.b# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } } a#?.{ $subj$.b# }?.{ { lval : = $subj$.c# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } } lval : = a#?.{ $subj$.b# }.c# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| a#?.{ { lval : = $subj$.b#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } } a#?.{ $subj$.b# }?.{ { lval : = $subj$.c#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } } lval : = a#?.{ $subj$.b# }.c#.get#(IntegerLiteral(0)) - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| lval : = a#?.{ $subj$.b# } lval : = R|/|.d#().inc#() diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.txt index c0ff77be96b..7ce37d68542 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.txt @@ -58,17 +58,17 @@ FILE: unary.kt public? final? fun test3(arr: Array): R|kotlin/Unit| { lval x1: = { lval : = arr# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } lval x2: = { lval : = arr# - lval : = IntegerLiteral(1) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(1) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } @@ -85,17 +85,17 @@ FILE: unary.kt public? final? fun test4(y: Y): R|kotlin/Unit| { lval x1: = { lval : = y#.arr# - lval : = IntegerLiteral(0) - lval : = R|/|.get#(R|/|) - R|/|.set#(R|/|, R|/|.inc#()) + lval : = IntegerLiteral(0) + lval : = R|/|.get#(R|/|) + R|/|.set#(R|/|, R|/|.inc#()) R|/| } lval x2: = { lval : = y#.arr# - lval : = IntegerLiteral(1) - lval : = R|/|.get#(R|/|).inc#() - R|/|.set#(R|/|, R|/|) + lval : = IntegerLiteral(1) + lval : = R|/|.get#(R|/|).inc#() + R|/|.set#(R|/|, R|/|) R|/| } diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index d339dc8609c..4518c1e3f38 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -715,7 +715,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte val argumentReceiverVariable = generateTemporaryVariable( baseModuleData, argumentReceiver?.toFirSourceElement(), - Name.special(""), + SpecialNames.RECEIVER, initializer = receiverFir, ).also { statements += it } @@ -795,7 +795,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte val arrayVariable = generateTemporaryVariable( baseModuleData, array?.toFirSourceElement(), - Name.special(""), + name = SpecialNames.ARRAY, initializer = arrayReceiver, ).also { statements += it } @@ -803,7 +803,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte generateTemporaryVariable( baseModuleData, index.toFirSourceElement(), - Name.special(""), + name = SpecialNames.subscribeOperatorIndex(i), index.convert() ).also { statements += it } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index c51751faf2a..e379e8027d0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -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 = "", + 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 = "", + name = SpecialNames.subscribeOperatorIndex(i), initializer = index ) } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt index 7b081b2502e..540bb16f892 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.fir.kt.txt @@ -22,24 +22,24 @@ class C { fun testVariable() { var x: IntArray = foo() { // BLOCK - val <>: IntArray = x - val <>: Int = 0 - <>.set(index = <>, value = <>.get(index = <>).plus(other = 1)) + val : IntArray = x + val : Int = 0 + .set(index = , value = .get(index = ).plus(other = 1)) } } fun testCall() { { // BLOCK - val <>: IntArray = foo() - val <>: Int = bar() - <>.set(index = <>, value = <>.get(index = <>).times(other = 2)) + val : IntArray = foo() + val : Int = bar() + .set(index = , value = .get(index = ).times(other = 2)) } } fun testMember(c: C) { val : IntArray = c.() - val : Int = 0 - val : Int = .get(index = ) - .set(index = , value = .inc()) + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt index 4c7242bb03b..8592f9cdd32 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.fir.kt.txt @@ -10,8 +10,8 @@ interface IB { fun IB.test(a: IA) { { // BLOCK - val <>: IA = a - val <>: String = "" - (, <>).set(index = <>, value = <>.get(index = <>).plus(other = 42)) + val : IA = a + val : String = "" + (, ).set(index = , value = .get(index = ).plus(other = 42)) } } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt index d5463ad08ef..5a02607a8f2 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt @@ -45,40 +45,40 @@ fun withVararg(vararg xs: Int): Int { fun test1() { { // BLOCK - val <>: A = A - val <>: KFunction1 = local fun withVararg(p0: Int) { + val : A = A + val : KFunction1 = local fun withVararg(p0: Int) { withVararg(xs = [p0]) } - <>.set(i = <> /*-> IFoo */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + .set(i = /*-> IFoo */, newValue = .get(i = /*-> IFoo */).plus(other = 1)) } } fun test2() { { // BLOCK - val <>: B = B - val <>: KFunction1 = local fun withVararg(p0: Int) { + val : B = B + val : KFunction1 = local fun withVararg(p0: Int) { withVararg(xs = [p0]) } - <>.set(i = <> /*-> IFoo2 */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + .set(i = /*-> IFoo2 */, newValue = .get(i = /*-> IFoo */).plus(other = 1)) } } fun test3(fn: Function1) { { // BLOCK - val <>: A = A - val <>: Function1 = fn - <>.set(i = <> /*-> IFoo */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + val : A = A + val : Function1 = fn + .set(i = /*-> IFoo */, newValue = .get(i = /*-> IFoo */).plus(other = 1)) } } fun test4(fn: Function1) { when { fn is IFoo -> { // BLOCK - val <>: A = A - val <>: IFoo = fn /*as IFoo */ - <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) + val : A = A + val : IFoo = fn /*as IFoo */ + .set(i = , newValue = .get(i = ).plus(other = 1)) } } } @@ -86,9 +86,9 @@ fun test4(fn: Function1) { fun test5(a: Any) { a as Function1 /*~> Unit */ { // BLOCK - val <>: A = A - val <>: Function1 = a /*as Function1 */ - <>.set(i = <> /*-> IFoo */, newValue = <>.get(i = <> /*-> IFoo */).plus(other = 1)) + val : A = A + val : Function1 = a /*as Function1 */ + .set(i = /*-> IFoo */, newValue = .get(i = /*-> IFoo */).plus(other = 1)) } } @@ -96,8 +96,8 @@ fun test6(a: Any) { a as Function1 /*~> Unit */ a /*as Function1 */ as IFoo /*~> Unit */ { // BLOCK - val <>: A = A - val <>: Function1 = a /*as Function1 */ - <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) + val : A = A + val : Function1 = a /*as Function1 */ + .set(i = , newValue = .get(i = ).plus(other = 1)) } } diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt index e0c7037a1d5..2f6d97119cd 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.kt.txt @@ -43,13 +43,13 @@ object X1 { fun test1(a: IntArray) { var i: Int = 0 val : IntArray = a - val : Int = { // BLOCK + val : Int = { // BLOCK val : Int = i i = .inc() } - val : Int = .get(index = ) - .set(index = , value = .inc()) + val : Int = .get(index = ) + .set(index = , value = .inc()) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt index ae5e74d0547..547e97490d8 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.kt.txt @@ -59,16 +59,16 @@ fun testPropPostfix() { fun testArrayPrefix() { val a1: Int = { // BLOCK val : IntArray = () - val : Int = 0 - val : Int = .get(index = ).inc() - .set(index = , value = ) + val : Int = 0 + val : Int = .get(index = ).inc() + .set(index = , value = ) } val a2: Int = { // BLOCK val : IntArray = () - val : Int = 0 - val : Int = .get(index = ).dec() - .set(index = , value = ) + val : Int = 0 + val : Int = .get(index = ).dec() + .set(index = , value = ) } } @@ -76,16 +76,16 @@ fun testArrayPrefix() { fun testArrayPostfix() { val a1: Int = { // BLOCK val : IntArray = () - val : Int = 0 - val : Int = .get(index = ) - .set(index = , value = .inc()) + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) } val a2: Int = { // BLOCK val : IntArray = () - val : Int = 0 - val : Int = .get(index = ) - .set(index = , value = .dec()) + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .dec()) } } diff --git a/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt index bea687736e0..e8bb7ed87bb 100644 --- a/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456.fir.kt.txt @@ -21,19 +21,19 @@ fun testSimpleAssignment(a: A) { fun testPostfixIncrement(a: A): Int { return { // BLOCK val : A = a - val : Int = 1 - val : Int = 2 - val : Int = .get(xs = [, ]) - .set(i = , j = , v = .inc()) + val : Int = 1 + val : Int = 2 + val : Int = .get(xs = [, ]) + .set(i = , j = , v = .inc()) } } fun testCompoundAssignment(a: A) { { // BLOCK - val <>: A = a - val <>: Int = 1 - val <>: Int = 2 - <>.set(i = <>, j = <>, v = <>.get(xs = [<>, <>]).plus(other = 10)) + val : A = a + val : Int = 1 + val : Int = 2 + .set(i = , j = , v = .get(xs = [, ]).plus(other = 10)) } } diff --git a/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt index 4261eb2d798..dfa31d44932 100644 --- a/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt28456b.fir.kt.txt @@ -21,17 +21,17 @@ fun testSimpleAssignment(a: A) { fun testPostfixIncrement(a: A): Int { return { // BLOCK val : A = a - val : Int = 1 - val : Int = .get(i = ) - .set(i = , v = .inc()) + val : Int = 1 + val : Int = .get(i = ) + .set(i = , v = .inc()) } } fun testCompoundAssignment(a: A) { { // BLOCK - val <>: A = a - val <>: Int = 1 - <>.set(i = <>, v = <>.get(i = <>).plus(other = 10)) + val : A = a + val : Int = 1 + .set(i = , v = .get(i = ).plus(other = 10)) } } diff --git a/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt index d5b48c07d6c..4c84df502e4 100644 --- a/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36956.fir.kt.txt @@ -25,9 +25,9 @@ val aFloat: A val aInt: Float field = { // BLOCK val : A = () - val : Int = 1 - val : Float = .get(i = ) - .set(i = , v = .dec()) + val : Int = 1 + val : Float = .get(i = ) + .set(i = , v = .dec()) } get diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt index 95d3257a0eb..007411d4ab7 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt @@ -17,22 +17,22 @@ fun test1(a: Any) { fun test2(a: Any) { { // BLOCK - val <>: Any = a - val <>: Function0 = local fun () { + val : Any = a + val : Function0 = local fun () { return Unit } - <>.set(index = <>, value = <>.get(index = <>).plus(other = 42)) + .set(index = , value = .get(index = ).plus(other = 42)) } } fun test3(a: Any) { val : Any = a - val : Function0 = local fun () { + val : Function0 = local fun () { return Unit } - val : Int = .get(index = ) - .set(index = , value = .inc()) + val : Int = .get(index = ) + .set(index = , value = .inc()) /*~> Unit */ } diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt index 645c0a39bf5..e1d287f4ef8 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.fir.kt.txt @@ -55,9 +55,9 @@ fun testArrayAccess(nc: C?) { EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null else -> { // BLOCK val : Int = tmp2_safe_receiver.() - val : Int = 0 - val : Int = .get(index = ) - .set(index = , value = .inc()) + val : Int = 0 + val : Int = .get(index = ) + .set(index = , value = .inc()) } } diff --git a/core/compiler.common/src/org/jetbrains/kotlin/name/SpecialNames.kt b/core/compiler.common/src/org/jetbrains/kotlin/name/SpecialNames.kt index 056e7a98dce..2de9e0de059 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/name/SpecialNames.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/name/SpecialNames.kt @@ -61,6 +61,24 @@ object SpecialNames { @JvmField val IMPLICIT_SET_PARAMETER = Name.special("") + @JvmField + val ARRAY = Name.special("") + + @JvmField + val RECEIVER = Name.special("") + + /** + * 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("") + } + @JvmStatic fun safeIdentifier(name: Name?): Name { return if (name != null && !name.isSpecial) name else SAFE_IDENTIFIER_FOR_NO_NAME