From b93357be480564056d192781c00a506653381e7f Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 28 Oct 2019 16:10:10 +0300 Subject: [PATCH] [FIR] Support assignment operators --- .../kotlin/fir/builder/BaseFirBuilder.kt | 9 +++ .../rawBuilder/expressions/destructuring.txt | 2 +- .../rawBuilder/expressions/modifications.txt | 12 ++-- .../FirExpressionsResolveTransformer.kt | 56 ++++++++++++++++++- .../resolve/expresssions/operators/plus.kt | 14 +++++ .../resolve/expresssions/operators/plus.txt | 20 +++++++ .../operators/plusAndPlusAssign.kt | 9 +++ .../operators/plusAndPlusAssign.txt | 17 ++++++ .../expresssions/operators/plusAssign.kt | 22 ++++++++ .../expresssions/operators/plusAssign.txt | 28 ++++++++++ compiler/fir/resolve/testData/resolve/fib.txt | 2 +- .../fir/FirResolveTestCaseGenerated.java | 28 ++++++++++ .../kotlin/fir/expressions/FirOperation.kt | 24 ++++++++ .../localDelegatedProperties.fir.txt | 5 +- .../expressions/augmentedAssignment1.fir.txt | 40 +++++++++---- .../expressions/augmentedAssignment2.fir.txt | 50 ++++++++++------- .../augmentedAssignmentWithExpression.fir.txt | 8 ++- .../expressions/breakContinueInWhen.fir.txt | 8 ++- .../complexAugmentedAssignment.fir.txt | 13 +++-- .../ir/irText/expressions/field.fir.txt | 4 +- .../ir/irText/expressions/kt16904.fir.txt | 13 +++-- .../ir/irText/expressions/kt24804.fir.txt | 4 +- .../ir/irText/expressions/kt27933.fir.txt | 8 ++- .../ir/irText/expressions/kt30020.fir.txt | 11 ++-- .../ir/irText/expressions/lambdaInCAO.fir.txt | 7 ++- .../expressions/sam/samOperators.fir.txt | 8 ++- 26 files changed, 354 insertions(+), 68 deletions(-) create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plus.kt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plus.txt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.txt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.kt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.txt diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index 8ba5be021b4..a41405685b9 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -475,6 +475,15 @@ abstract class BaseFirBuilder(val session: FirSession, val context: Context = } } } + + if (operation in FirOperation.ASSIGNMENTS && operation != FirOperation.ASSIGN) { + return FirOperatorCallImpl(psi, operation).apply { + // TODO: take good psi + arguments += this@generateAssignment?.convert() ?: FirErrorExpressionImpl(null, "Unsupported left value of assignment: ${psi?.text}") + arguments += value + } + } + return FirVariableAssignmentImpl(psi, false, value, operation).apply { lValue = initializeLValue(this@generateAssignment) { convert() as? FirQualifiedAccess } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt index b388bdd3fe8..9b35f5b5fdc 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt @@ -37,6 +37,6 @@ FILE: destructuring.kt lval : = x# x# = R|/|.inc#() R|/| - y# *= Double(2.0) + *=(y#, Double(2.0)) z# = String() } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt index 40a42b78470..e7bf81c09e5 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt @@ -1,14 +1,14 @@ FILE: modifications.kt public? final? fun simple(): kotlin/Unit { lvar x: = Int(10) - x# += Int(20) - x# -= Int(5) - x# /= Int(5) - x# *= Int(10) + +=(x#, Int(20)) + -=(x#, Int(5)) + /=(x#, Int(5)) + *=(x#, Int(10)) } public? final? fun List.modify(): kotlin/Unit { - this# += String(Alpha) - this# += String(Omega) + +=(this#, String(Alpha)) + +=(this#, String(Omega)) } public? final? fun Any.modify(): kotlin/Unit { lval : = (this# as List) 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 17cbc2ef254..87f360952dc 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 @@ -5,14 +5,16 @@ package org.jetbrains.kotlin.fir.resolve.transformers.body.resolve -import org.jetbrains.kotlin.contracts.description.InvocationKind import org.jetbrains.kotlin.fir.* -import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction import org.jetbrains.kotlin.fir.expressions.* +import org.jetbrains.kotlin.fir.expressions.impl.FirErrorExpressionImpl import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionWithSmartcastImpl +import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl +import org.jetbrains.kotlin.fir.expressions.impl.FirVariableAssignmentImpl import org.jetbrains.kotlin.fir.references.FirDelegateFieldReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.references.FirSuperReference +import org.jetbrains.kotlin.fir.references.impl.FirErrorNamedReferenceImpl import org.jetbrains.kotlin.fir.references.impl.FirExplicitThisReference import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference import org.jetbrains.kotlin.fir.render @@ -27,6 +29,7 @@ import org.jetbrains.kotlin.fir.resolve.withNullability import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype import org.jetbrains.kotlin.fir.scopes.impl.withReplacedConeType import org.jetbrains.kotlin.fir.symbols.StandardClassIds +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.fir.symbols.invoke import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassTypeImpl @@ -34,11 +37,11 @@ import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl import org.jetbrains.kotlin.fir.types.impl.FirImplicitUnitTypeRef import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult -import org.jetbrains.kotlin.fir.visitors.FirTransformer import org.jetbrains.kotlin.fir.visitors.compose import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.Name class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : FirPartialBodyResolveTransformer(transformer) { private val callResolver: FirCallResolver get() = components.callResolver @@ -187,6 +190,53 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : } else { transformExpression(operatorCall, data).single } as FirOperatorCall + + if (operatorCall.operation in FirOperation.ASSIGNMENTS) { + require(operatorCall.operation != FirOperation.ASSIGN) + @Suppress("NAME_SHADOWING") + val operatorCall = operatorCall.transformArguments(this, noExpectedType) + val (leftArgument, rightArgument) = operatorCall.arguments + + fun createFunctionCall(name: Name) = FirFunctionCallImpl(operatorCall.psi).apply { + explicitReceiver = leftArgument + arguments += rightArgument + calleeReference = FirSimpleNamedReference( + operatorCall.psi, + name, + candidateSymbol = null + ) + } + + // TODO: disable DataFlowAnalyzer for resolving that two calls + // x.plusAssign(y) + val assignmentOperatorName = FirOperationNameConventions.ASSIGNMENTS.getValue(operatorCall.operation) + val assignOperatorCall = createFunctionCall(assignmentOperatorName) + val resolvedAssignCall = assignOperatorCall.transformSingle(this, noExpectedType) + val assignCallReference = resolvedAssignCall.toResolvedCallableReference() + // x + y + val simpleOperatorName = FirOperationNameConventions.ASSIGNMENTS_TO_SIMPLE_OPERATOR.getValue(operatorCall.operation) + val simpleOperatorCall = createFunctionCall(simpleOperatorName) + val resolvedOperatorCall = simpleOperatorCall.transformSingle(this, noExpectedType) + val operatorCallReference = resolvedOperatorCall.toResolvedCallableReference() + + val property = (leftArgument.toResolvedCallableSymbol() as? FirPropertySymbol)?.fir + return when { + operatorCallReference == null || property?.isVal == true -> resolvedAssignCall.compose() + assignCallReference == null -> { + val assignment = + FirVariableAssignmentImpl(operatorCall.psi, false, resolvedOperatorCall, FirOperation.ASSIGN).apply { + lValue = (leftArgument as? FirQualifiedAccess)?.calleeReference + ?: FirErrorNamedReferenceImpl(null, "Unresolved reference") + } + assignment.transform(transformer, noExpectedType) + } + else -> FirErrorExpressionImpl( + operatorCall.psi, + "Operator overload ambiguity. $assignmentOperatorName and $simpleOperatorName are compatible" + ).compose() + } + } + dataFlowAnalyzer.exitOperatorCall(result) return result.compose() } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.kt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.kt new file mode 100644 index 00000000000..10a0bb25702 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.kt @@ -0,0 +1,14 @@ +class Foo { + operator fun plus(other: Foo): Foo = this +} + +fun test_1() { + val f1 = Foo() + val f2 = Foo() + val f3 = f1 + f2 +} + +fun test_2() { + var f = Foo() + f += Foo() +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.txt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.txt new file mode 100644 index 00000000000..2f77bc0fd9a --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plus.txt @@ -0,0 +1,20 @@ +FILE: plus.kt + public final class Foo : R|kotlin/Any| { + public constructor(): R|Foo| { + super() + } + + public final operator fun plus(other: R|Foo|): R|Foo| { + ^plus this@R|/Foo| + } + + } + public final fun test_1(): R|kotlin/Unit| { + lval f1: R|Foo| = R|/Foo.Foo|() + lval f2: R|Foo| = R|/Foo.Foo|() + lval f3: R|Foo| = R|/f1|.R|/Foo.plus|(R|/f2|) + } + public final fun test_2(): R|kotlin/Unit| { + lvar f: R|Foo| = R|/Foo.Foo|() + R|/f| = R|/f|.R|/Foo.plus|(R|/Foo.Foo|()) + } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt new file mode 100644 index 00000000000..0733d749ea4 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt @@ -0,0 +1,9 @@ +class Foo { + operator fun plus(f: Foo): Foo {} + operator fun plusAssign(f: Foo) {} +} + +fun test() { + var f = Foo() + f += f +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.txt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.txt new file mode 100644 index 00000000000..67179e3324d --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.txt @@ -0,0 +1,17 @@ +FILE: plusAndPlusAssign.kt + public final class Foo : R|kotlin/Any| { + public constructor(): R|Foo| { + super() + } + + public final operator fun plus(f: R|Foo|): R|Foo| { + } + + public final operator fun plusAssign(f: R|Foo|): R|kotlin/Unit| { + } + + } + public final fun test(): R|kotlin/Unit| { + lvar f: R|Foo| = R|/Foo.Foo|() + ERROR_EXPR(Operator overload ambiguity. plusAssign and plus are compatible) + } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.kt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.kt new file mode 100644 index 00000000000..fd87067b6c7 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.kt @@ -0,0 +1,22 @@ +operator fun Foo.plusAssign(x: Any) {} + +class Foo { + operator fun plusAssign(x: Foo) {} + operator fun plusAssign(x: String) {} +} + +fun test_1() { + val f = Foo() + f + f +} + +fun test_2() { + val f = Foo() + f += f +} + +fun test_3(f: Foo) { + f += f + f += "" + f += 1 +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.txt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.txt new file mode 100644 index 00000000000..0361b6bceb4 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.txt @@ -0,0 +1,28 @@ +FILE: plusAssign.kt + public final operator fun R|Foo|.plusAssign(x: R|kotlin/Any|): R|kotlin/Unit| { + } + public final class Foo : R|kotlin/Any| { + public constructor(): R|Foo| { + super() + } + + public final operator fun plusAssign(x: R|Foo|): R|kotlin/Unit| { + } + + public final operator fun plusAssign(x: R|kotlin/String|): R|kotlin/Unit| { + } + + } + public final fun test_1(): R|kotlin/Unit| { + lval f: R|Foo| = R|/Foo.Foo|() + R|/f|.#(R|/f|) + } + public final fun test_2(): R|kotlin/Unit| { + lval f: R|Foo| = R|/Foo.Foo|() + R|/f|.R|/Foo.plusAssign|(R|/f|) + } + public final fun test_3(f: R|Foo|): R|kotlin/Unit| { + R|/f|.R|/Foo.plusAssign|(R|/f|) + R|/f|.R|/Foo.plusAssign|(String()) + R|/f|.R|/plusAssign|(Int(1)) + } diff --git a/compiler/fir/resolve/testData/resolve/fib.txt b/compiler/fir/resolve/testData/resolve/fib.txt index f7f6bd103a1..195acecb1d0 100644 --- a/compiler/fir/resolve/testData/resolve/fib.txt +++ b/compiler/fir/resolve/testData/resolve/fib.txt @@ -13,7 +13,7 @@ FILE: fib.kt while(R|/|.R|kotlin/collections/Iterator.hasNext|()) { lval i: R|kotlin/Int| = R|/|.R|kotlin/collections/IntIterator.next|() lval temp: R|kotlin/Int| = R|/current| - R|/current| += R|/prev| + R|/current| = R|/current|.R|kotlin/Int.plus|(R|/prev|) R|/prev| = R|/temp| } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java index e73e4af4bd7..0d7259c9c31 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java @@ -476,6 +476,34 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase { runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/threeReceivers.kt"); } } + + @TestMetadata("compiler/fir/resolve/testData/resolve/expresssions/operators") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Operators extends AbstractFirResolveTestCase { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOperators() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/expresssions/operators"), Pattern.compile("^([^.]+)\\.kt$"), true); + } + + @TestMetadata("plus.kt") + public void testPlus() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/operators/plus.kt"); + } + + @TestMetadata("plusAndPlusAssign.kt") + public void testPlusAndPlusAssign() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt"); + } + + @TestMetadata("plusAssign.kt") + public void testPlusAssign() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/operators/plusAssign.kt"); + } + } } @TestMetadata("compiler/fir/resolve/testData/resolve/fromBuilder") diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt index 75c25a984d2..48ca42b448f 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt @@ -5,6 +5,8 @@ package org.jetbrains.kotlin.fir.expressions +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.util.OperatorNameConventions import java.util.* enum class FirOperation(val operator: String = "???") { @@ -46,4 +48,26 @@ enum class FirOperation(val operator: String = "???") { val TYPES: Set = EnumSet.of(IS, NOT_IS, AS, SAFE_AS) } +} + +object FirOperationNameConventions { + val ASSIGNMENTS: Map = EnumMap( + mapOf( + FirOperation.PLUS_ASSIGN to OperatorNameConventions.PLUS_ASSIGN, + FirOperation.MINUS_ASSIGN to OperatorNameConventions.MINUS_ASSIGN, + FirOperation.TIMES_ASSIGN to OperatorNameConventions.TIMES_ASSIGN, + FirOperation.DIV_ASSIGN to OperatorNameConventions.DIV_ASSIGN, + FirOperation.REM_ASSIGN to OperatorNameConventions.REM_ASSIGN + ) + ) + + val ASSIGNMENTS_TO_SIMPLE_OPERATOR: Map = EnumMap( + mapOf( + FirOperation.PLUS_ASSIGN to OperatorNameConventions.PLUS, + FirOperation.MINUS_ASSIGN to OperatorNameConventions.MINUS, + FirOperation.TIMES_ASSIGN to OperatorNameConventions.TIMES, + FirOperation.DIV_ASSIGN to OperatorNameConventions.DIV, + FirOperation.REM_ASSIGN to OperatorNameConventions.REM + ) + ) } \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt index 4677abe9222..139db7ac37d 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt @@ -14,5 +14,6 @@ FILE fqName: fileName:/localDelegatedProperties.kt SET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'val : IrErrorType [val] declared in .test2' type=IrErrorType origin=null - SET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null - CONST Int type=IrErrorType value=1 + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: GET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null + element: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt index c8154b08939..f30a104d48a 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt @@ -19,24 +19,44 @@ FILE fqName: fileName:/augmentedAssignment1.kt VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=1 + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=1 SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=2 + CALL 'public final fun minus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=2 SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=3 + CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=3 SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=4 + CALL 'public final fun div (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=4 SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=5 + CALL 'public final fun rem (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=5 FUN name:testProperty visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: CONST Int type=kotlin.Int value=1 + value: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=1 SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: CONST Int type=kotlin.Int value=2 + value: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=2 SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: CONST Int type=kotlin.Int value=3 + value: CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=3 SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: CONST Int type=kotlin.Int value=4 + value: CALL 'public final fun div (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=4 SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: CONST Int type=kotlin.Int value=5 + value: CALL 'public final fun rem (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=5 diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt index 2000b7c021a..c1af3bad04a 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt @@ -51,25 +51,35 @@ FILE fqName: fileName:/augmentedAssignment2.kt BLOCK_BODY VAR name:a type:.A [val] CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' type=.A origin=null - SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null - CONST String type=.A value="+=" - SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null - CONST String type=.A value="-=" - SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null - CONST String type=.A value="*=" - SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null - CONST String type=.A value="/=" - SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null - CONST String type=.A value="*=" + CALL 'public final fun plusAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + s: CONST String type=kotlin.String value="+=" + CALL 'public final fun minusAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + s: CONST String type=kotlin.String value="-=" + CALL 'public final fun timesAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + s: CONST String type=kotlin.String value="*=" + CALL 'public final fun divAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + s: CONST String type=kotlin.String value="/=" + CALL 'public final fun remAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + s: CONST String type=kotlin.String value="*=" FUN name:testProperty visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:private [final,static]' type=kotlin.Unit origin=null - value: CONST String type=.A value="+=" - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:private [final,static]' type=kotlin.Unit origin=null - value: CONST String type=.A value="-=" - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:private [final,static]' type=kotlin.Unit origin=null - value: CONST String type=.A value="*=" - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:private [final,static]' type=kotlin.Unit origin=null - value: CONST String type=.A value="/=" - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:private [final,static]' type=kotlin.Unit origin=null - value: CONST String type=.A value="%=" + CALL 'public final fun plusAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: CALL 'public final fun (): .A declared in ' type=.A origin=null + s: CONST String type=kotlin.String value="+=" + CALL 'public final fun minusAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: CALL 'public final fun (): .A declared in ' type=.A origin=null + s: CONST String type=kotlin.String value="-=" + CALL 'public final fun timesAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: CALL 'public final fun (): .A declared in ' type=.A origin=null + s: CONST String type=kotlin.String value="*=" + CALL 'public final fun divAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: CALL 'public final fun (): .A declared in ' type=.A origin=null + s: CONST String type=kotlin.String value="/=" + CALL 'public final fun remAssign (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: CALL 'public final fun (): .A declared in ' type=.A origin=null + s: CONST String type=kotlin.String value="%=" diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt index ef1ee328e7f..400d8932075 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt @@ -12,7 +12,9 @@ FILE fqName: fileName:/augmentedAssignmentWithExpression.kt FUN name:test1 visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Host BLOCK_BODY - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType + CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit declared in .Host' type=kotlin.Unit origin=null + $this: GET_VAR ': .Host declared in .Host' type=.Host origin=null + x: CONST Int type=kotlin.Int value=1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any @@ -33,7 +35,9 @@ FILE fqName: fileName:/augmentedAssignmentWithExpression.kt FUN name:test2 visibility:public modality:FINAL <> ($receiver:.Host) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.Host BLOCK_BODY - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType + CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit declared in .Host' type=kotlin.Unit origin=null + $this: GET_VAR ': .Host declared in .test2' type=.Host origin=null + x: CONST Int type=kotlin.Int value=1 FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name: type:.Host [val] diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt index 6f9d9a0c93f..489343962ca 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt @@ -122,9 +122,11 @@ FILE fqName: fileName:/breakContinueInWhen.kt arg1: CONST Int type=kotlin.Int value=2 then: CONTINUE label=null loop.label=null SET_VAR 'var s: kotlin.String [var] declared in .testContinueDoWhile' type=kotlin.String origin=null - STRING_CONCATENATION type=kotlin.String - GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null - CONST String type=kotlin.String value=";" + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=null + $this: GET_VAR 'var s: kotlin.String [var] declared in .testContinueDoWhile' type=kotlin.String origin=null + other: STRING_CONCATENATION type=kotlin.String + GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null + CONST String type=kotlin.String value=";" condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt index c8c9780ce5c..00c58aeddb2 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt @@ -219,9 +219,11 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt VALUE_PARAMETER name:b index:0 type:.B BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': .B declared in .Host.plusAssign' type=.B origin=null - value: CALL 'public final fun (): kotlin.Int declared in .B' type=kotlin.Int origin=null - $this: GET_VAR 'b: .B declared in .Host.plusAssign' type=.B origin=null + value: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in .B' type=kotlin.Int origin=null + $this: GET_VAR ': .B declared in .Host.plusAssign' type=.B origin=null + other: CALL 'public final fun (): kotlin.Int declared in .B' type=kotlin.Int origin=null + $this: GET_VAR 'b: .B declared in .Host.plusAssign' type=.B origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any @@ -239,4 +241,7 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt $receiver: VALUE_PARAMETER name: type:.Host VALUE_PARAMETER name:v index:0 type:.B BLOCK_BODY - ERROR_CALL 'Unresolved reference: R|/v|' type=IrErrorType + CALL 'public final fun plusAssign (b: .B): kotlin.Unit declared in .Host' type=kotlin.Unit origin=null + $this: GET_VAR ': .Host declared in .Host' type=.Host origin=null + b: CONSTRUCTOR_CALL 'public constructor (s: kotlin.Int) [primary] declared in .B' type=.B origin=null + s: CONST Int type=kotlin.Int value=1000 diff --git a/compiler/testData/ir/irText/expressions/field.fir.txt b/compiler/testData/ir/irText/expressions/field.fir.txt index b8e9dfbca38..d462e474dff 100644 --- a/compiler/testData/ir/irText/expressions/field.fir.txt +++ b/compiler/testData/ir/irText/expressions/field.fir.txt @@ -28,4 +28,6 @@ FILE fqName: fileName:/field.kt VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null - value: GET_VAR 'value: kotlin.Int declared in .' type=kotlin.Int origin=null + value: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=GET_PROPERTY + other: GET_VAR 'value: kotlin.Int declared in .' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/kt16904.fir.txt b/compiler/testData/ir/irText/expressions/kt16904.fir.txt index 9c374a8f126..556ae2f97fc 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.fir.txt @@ -75,12 +75,15 @@ FILE fqName: fileName:/kt16904.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test1 CONSTRUCTOR visibility:public <> () returnType:.Test1 BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:private [final]' type=kotlin.Unit origin=null - receiver: GET_VAR ': .A declared in .A' type=.A origin=null - value: CONST Int type=.B value=42 + CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit declared in .B' type=kotlin.Unit origin=null + $this: CALL 'public final fun (): .B declared in .A' type=.B origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null + x: CONST Int type=kotlin.Int value=42 SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': .A declared in .A' type=.A origin=null - value: CONST Int type=kotlin.Int value=42 + value: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null + other: CONST Int type=kotlin.Int value=42 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[.A]' PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [val] diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.txt index 27b548313f4..ed6b760f7f2 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.txt @@ -12,7 +12,9 @@ FILE fqName: fileName:/kt24804.kt DO_WHILE label=l2 origin=DO_WHILE_LOOP body: BLOCK type=kotlin.Unit origin=null SET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null - CONST Int type=kotlin.Int value=1 + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=1 WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT diff --git a/compiler/testData/ir/irText/expressions/kt27933.fir.txt b/compiler/testData/ir/irText/expressions/kt27933.fir.txt index 8103ccaf2aa..b429e5d6162 100644 --- a/compiler/testData/ir/irText/expressions/kt27933.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt27933.fir.txt @@ -14,7 +14,9 @@ FILE fqName: fileName:/kt27933.kt if: CONST Boolean type=kotlin.Boolean value=true then: BLOCK type=kotlin.Unit origin=null SET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null - CONST String type=kotlin.String value="O" + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=null + $this: GET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null + other: CONST String type=kotlin.String value="O" WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ @@ -22,6 +24,8 @@ FILE fqName: fileName:/kt27933.kt arg1: CONST String type=kotlin.String value="O" then: BLOCK type=kotlin.Unit origin=null SET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null - CONST String type=kotlin.String value="K" + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=null + $this: GET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null + other: CONST String type=kotlin.String value="K" RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' GET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.txt index 07e241abcf3..06c8c9d8669 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.txt @@ -24,7 +24,10 @@ FILE fqName: fileName:/kt30020.kt VALUE_PARAMETER name:x index:0 type:.X VALUE_PARAMETER name:nx index:1 type:.X? BLOCK_BODY - ERROR_CALL 'Unresolved reference: R|/X.xs|' type=IrErrorType + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: CALL 'public abstract fun (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null + $this: GET_VAR 'x: .X declared in .test' type=.X origin=null + element: CONST Int type=kotlin.Int value=1 VAR name: type:kotlin.collections.MutableList [val] CALL 'public abstract fun f (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null $this: GET_VAR 'x: .X declared in .test' type=.X origin=null @@ -79,7 +82,7 @@ FILE fqName: fileName:/kt30020.kt FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:kotlin.collections.MutableList BLOCK_BODY - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType + ERROR_EXPR 'Operator overload ambiguity. plusAssign and plus are compatible' type=IrErrorType CLASS CLASS name:AML modality:ABSTRACT visibility:public superTypes:[kotlin.collections.MutableList] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.AML CONSTRUCTOR visibility:public <> () returnType:.AML [primary] @@ -89,7 +92,7 @@ FILE fqName: fileName:/kt30020.kt FUN name:testExplicitThis visibility:public modality:FINAL <> ($this:.AML) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.AML BLOCK_BODY - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType + ERROR_EXPR 'Operator overload ambiguity. plusAssign and plus are compatible' type=IrErrorType CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.AML.Inner CONSTRUCTOR visibility:public <> () returnType:.AML.Inner [primary] @@ -99,7 +102,7 @@ FILE fqName: fileName:/kt30020.kt FUN name:testOuterThis visibility:public modality:FINAL <> ($this:.AML.Inner) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.AML.Inner BLOCK_BODY - ERROR_CALL 'Unresolved reference: this@AML#' type=IrErrorType + ERROR_EXPR 'Operator overload ambiguity. plusAssign and plus are compatible' type=IrErrorType FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.txt index 09f8d839f63..0b94efef450 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.txt @@ -17,7 +17,12 @@ FILE fqName: fileName:/lambdaInCAO.kt FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType + CALL 'public final fun plusAssign (lambda: kotlin.Function0): kotlin.Unit declared in ' type=kotlin.Unit origin=null + $receiver: GET_VAR 'a: kotlin.Any declared in .test1' type=kotlin.Any origin=null + lambda: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt index a16de28ed79..425fb5896e4 100644 --- a/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samOperators.fir.txt @@ -26,5 +26,9 @@ FILE fqName: fileName:/samOperators.kt FUN name:test3 visibility:public modality:FINAL <> ($receiver:.J) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.J BLOCK_BODY - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType - ERROR_CALL 'Unresolved reference: this#' type=IrErrorType + CALL 'public open fun plusAssign (i: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + $this: GET_VAR ': .J declared in .test3' type=.J origin=null + i: ERROR_CALL 'Unsupported callable reference: ::#' type=IrErrorType + CALL 'public open fun minusAssign (i: java.lang.Runnable?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + $this: GET_VAR ': .J declared in .test3' type=.J origin=null + i: ERROR_CALL 'Unsupported callable reference: ::#' type=IrErrorType