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 06e96fdce58..e7aab52e2d2 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 @@ -463,22 +463,6 @@ abstract class BaseFirBuilder(val session: FirSession, val context: Context = statements += arraySet.apply { lValue = FirSimpleNamedReference(psiArrayExpression?.toFirSourceElement(), name, null) } } } - if (operation != FirOperation.ASSIGN && - tokenType != REFERENCE_EXPRESSION && tokenType != THIS_EXPRESSION && - ((tokenType != DOT_QUALIFIED_EXPRESSION && tokenType != SAFE_ACCESS_EXPRESSION) || this.selectorExpression?.elementType != REFERENCE_EXPRESSION) - ) { - return FirBlockImpl(this.getSourceOrNull()).apply { - val name = Name.special("") - statements += generateTemporaryVariable( - this@BaseFirBuilder.session, this@generateAssignment.getSourceOrNull(), name, - this@generateAssignment?.convert() - ?: FirErrorExpressionImpl(this.getSourceOrNull(), FirSimpleDiagnostic("No LValue in assignment", DiagnosticKind.Syntax)) - ) - statements += FirVariableAssignmentImpl(source, false, value, operation).apply { - lValue = FirSimpleNamedReference(this.getSourceOrNull(), name, null) - } - } - } if (operation in FirOperation.ASSIGNMENTS && operation != FirOperation.ASSIGN) { return FirOperatorCallImpl(source, operation).apply { diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt index 80a0625bc07..281162e5ca3 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt @@ -64,11 +64,10 @@ FILE: lambda.kt public? final? fun test(list: List): R|kotlin/Unit| { lval map: = mutableMapOf#() list#.forEach#( = forEach@fun .(): { - lval : = map#.getOrPut#(it#, getOrPut@fun .(): { + +=(map#.getOrPut#(it#, getOrPut@fun .(): { mutableListOf#() } - ) - # += String() + ), String()) } ) } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt index 62ab63d6241..86b23db054b 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/modifications.txt @@ -11,6 +11,5 @@ FILE: modifications.kt +=(this#, String(Omega)) } public? final? fun Any.modify(): R|kotlin/Unit| { - lval : = (this# as List) - # += Int(42) + +=((this# as List), Int(42)) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt index a13458613d3..bdfb584c1ec 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt @@ -37,6 +37,10 @@ class FirOperatorAmbiguityError(val candidates: Collection): String { return when (symbol) { is FirClassLikeSymbol<*> -> symbol.classId.asString() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index 4adcde617e2..4b2db1e9cea 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt @@ -56,6 +56,7 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect is FirInapplicableCandidateError -> FirErrors.INAPPLICABLE_CANDIDATE.onSource(source, diagnostic.candidates) is FirAmbiguityError -> FirErrors.AMBIGUITY.onSource(source, diagnostic.candidates) is FirOperatorAmbiguityError -> FirErrors.ASSIGN_OPERATOR_AMBIGUITY.onSource(source, diagnostic.candidates) + is FirVariableExpectedError -> Errors.VARIABLE_EXPECTED.onSource(source) is FirSimpleDiagnostic -> diagnostic.getFactory().onSource(source) FirEmptyDiagnostic -> null else -> throw IllegalArgumentException("Unsupported diagnostic type: ${diagnostic.javaClass}") 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 9cd5b9f4158..8eb4f9783f8 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 @@ -7,7 +7,9 @@ package org.jetbrains.kotlin.fir.resolve.transformers.body.resolve import org.jetbrains.kotlin.fir.BuiltinTypes import org.jetbrains.kotlin.fir.FirCallResolver +import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.FirTypeParametersOwner +import org.jetbrains.kotlin.fir.declarations.FirVariable import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic import org.jetbrains.kotlin.fir.expressions.* @@ -26,13 +28,14 @@ import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.calls.ConeInferenceContext import org.jetbrains.kotlin.fir.resolve.calls.candidate import org.jetbrains.kotlin.fir.resolve.diagnostics.FirOperatorAmbiguityError -import org.jetbrains.kotlin.fir.resolve.diagnostics.FirUnresolvedReferenceError +import org.jetbrains.kotlin.fir.resolve.diagnostics.FirVariableExpectedError import org.jetbrains.kotlin.fir.resolve.transformers.InvocationKindTransformer import org.jetbrains.kotlin.fir.resolve.transformers.StoreReceiver 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.impl.FirVariableSymbol import org.jetbrains.kotlin.fir.symbols.invoke import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassTypeImpl @@ -200,13 +203,13 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : } override fun transformOperatorCall(operatorCall: FirOperatorCall, data: ResolutionMode): CompositeTransformResult { - val result = if (operatorCall.operation in FirOperation.BOOLEANS) { - (operatorCall.transformChildren(transformer, ResolutionMode.ContextIndependent) as FirOperatorCall).also { + if (operatorCall.operation in FirOperation.BOOLEANS) { + val result = (operatorCall.transformChildren(transformer, ResolutionMode.ContextIndependent) as FirOperatorCall).also { it.resultType = builtinTypes.booleanType } - } else { - transformExpression(operatorCall, data).single - } as FirOperatorCall + dataFlowAnalyzer.exitOperatorCall(result) + return result.compose() + } if (operatorCall.operation in FirOperation.ASSIGNMENTS) { require(operatorCall.operation != FirOperation.ASSIGN) @@ -230,20 +233,24 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : val assignOperatorCall = createFunctionCall(assignmentOperatorName) val resolvedAssignCall = assignOperatorCall.transformSingle(this, ResolutionMode.ContextIndependent) val assignCallReference = resolvedAssignCall.toResolvedCallableReference() - // x + y + val assignIsError = resolvedAssignCall.typeRef is FirErrorTypeRef + // x = x + y val simpleOperatorName = FirOperationNameConventions.ASSIGNMENTS_TO_SIMPLE_OPERATOR.getValue(operatorCall.operation) val simpleOperatorCall = createFunctionCall(simpleOperatorName) val resolvedOperatorCall = simpleOperatorCall.transformSingle(this, ResolutionMode.ContextIndependent) val operatorCallReference = resolvedOperatorCall.toResolvedCallableReference() - val property = (leftArgument.toResolvedCallableSymbol() as? FirPropertySymbol)?.fir + val lhsReference = leftArgument.toResolvedCallableReference() + val lhsIsVar = (lhsReference?.resolvedSymbol as? FirVariableSymbol<*>)?.fir?.isVar == true return when { - operatorCallReference == null || property?.isVal == true -> resolvedAssignCall.compose() + operatorCallReference == null || (!lhsIsVar && !assignIsError) -> resolvedAssignCall.compose() assignCallReference == null -> { val assignment = FirVariableAssignmentImpl(operatorCall.source, false, resolvedOperatorCall, FirOperation.ASSIGN).apply { - lValue = (leftArgument as? FirQualifiedAccess)?.calleeReference - ?: FirErrorNamedReferenceImpl(null, FirUnresolvedReferenceError()) + lValue = if (lhsIsVar) + lhsReference!! + else + FirErrorNamedReferenceImpl(operatorCall.arguments.first().source, FirVariableExpectedError()) } assignment.transform(transformer, ResolutionMode.ContextIndependent) } @@ -254,8 +261,7 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : } } - dataFlowAnalyzer.exitOperatorCall(result) - return result.compose() + throw IllegalArgumentException(operatorCall.render()) } override fun transformTypeOperatorCall(typeOperatorCall: FirTypeOperatorCall, data: ResolutionMode): CompositeTransformResult { diff --git a/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt b/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt new file mode 100644 index 00000000000..ba558bf0194 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt @@ -0,0 +1,10 @@ +var x: Int = 1 + set(value) { + field += value + } + +val y: Int = 1 + get() { + field += 1 + return 1 + } diff --git a/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.txt b/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.txt new file mode 100644 index 00000000000..b59264c4e4b --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.txt @@ -0,0 +1,11 @@ +FILE: fieldPlusAssign.kt + public final var x: R|kotlin/Int| = Int(1) + public get(): R|kotlin/Int| + public set(value: R|kotlin/Int|): R|kotlin/Unit| { + F|/x| = F|/x|.R|kotlin/Int.plus|(R|/value|) + } + public final val y: R|kotlin/Int| = Int(1) + public get(): R|kotlin/Int| { + # = F|/y|.R|kotlin/Int.plus|(Int(1)) + ^ Int(1) + } diff --git a/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.kt b/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.kt new file mode 100644 index 00000000000..12a9b9ba7a4 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.kt @@ -0,0 +1,19 @@ +fun List.modify() { + this += "Alpha" + this += "Omega" +} + +fun Any.modify() { + (this as List) += 42 +} + +operator fun Set.plusAssign(x: T) {} + +fun Set.modify() { + this += "Alpha" + this += "Omega" +} + +fun Any.modifySet() { + (this as Set) += 42 +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.txt b/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.txt new file mode 100644 index 00000000000..bcce2c302ae --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.txt @@ -0,0 +1,17 @@ +FILE: listPlusAssign.kt + public final fun R|kotlin/collections/List|.modify(): R|kotlin/Unit| { + # = this@R|/modify|.R|kotlin/collections/plus|(String(Alpha)) + # = this@R|/modify|.R|kotlin/collections/plus|(String(Omega)) + } + public final fun R|kotlin/Any|.modify(): R|kotlin/Unit| { + # = (this@R|/modify| as R|kotlin/collections/List|).R|kotlin/collections/plus|(Int(42)) + } + public final operator fun R|kotlin/collections/Set|.plusAssign(x: R|T|): R|kotlin/Unit| { + } + public final fun R|kotlin/collections/Set|.modify(): R|kotlin/Unit| { + this@R|/modify|.R|/plusAssign|(String(Alpha)) + this@R|/modify|.R|/plusAssign|(String(Omega)) + } + public final fun R|kotlin/Any|.modifySet(): R|kotlin/Unit| { + (this@R|/modifySet| as R|kotlin/collections/Set|).R|/plusAssign|(Int(42)) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 85450449de9..c1a91aa5aa8 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -230,6 +230,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/arguments/default.kt"); } + @TestMetadata("fieldPlusAssign.kt") + public void testFieldPlusAssign() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt"); + } + @TestMetadata("invoke.kt") public void testInvoke() throws Exception { runTest("compiler/fir/resolve/testData/resolve/arguments/invoke.kt"); diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index e6eb931bc0d..78b79910ada 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -98,6 +98,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/resolve/testData/resolve/stdlib/implicitReceiverOrder.kt"); } + @TestMetadata("listPlusAssign.kt") + public void testListPlusAssign() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/stdlib/listPlusAssign.kt"); + } + @TestMetadata("mapList.kt") public void testMapList() throws Exception { runTest("compiler/fir/resolve/testData/resolve/stdlib/mapList.kt"); diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt index 762043a3876..a11bfe0d51a 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt @@ -40,15 +40,13 @@ FILE fqName: fileName:/augmentedAssignmentWithExpression.kt x: CONST Int type=kotlin.Int value=1 FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Host [val] - CALL 'public final fun foo (): .Host declared in ' type=.Host origin=null - SET_VAR 'val tmp_0: .Host [val] declared in .test3' type=.Host origin=null - CONST Int type=.Host value=1 + CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit declared in .Host' type=kotlin.Unit origin=null + $this: CALL 'public final fun foo (): .Host declared in ' type=.Host origin=null + x: CONST Int type=kotlin.Int value=1 FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<.Host>) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0<.Host> BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Host [val] - CALL 'public abstract fun invoke (): .Host declared in kotlin.Function0' type=.Host origin=null + CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit declared in .Host' type=kotlin.Unit origin=null + $this: CALL 'public abstract fun invoke (): .Host declared in kotlin.Function0' type=.Host origin=null $this: GET_VAR 'a: kotlin.Function0<.Host> declared in .test4' type=kotlin.Function0<.Host> origin=null - SET_VAR 'val tmp_1: .Host [val] declared in .test4' type=.Host origin=null - CONST Int type=.Host value=1 + x: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.txt b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.txt index a3d42fa4e9d..353430ba8c2 100644 --- a/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.txt +++ b/compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.fir.txt @@ -10,4 +10,4 @@ FILE fqName: fileName:/javaSyntheticPropertyAccess.kt $this: GET_VAR 'j: .J declared in .test' type=.J origin=null ERROR_CALL 'Unresolved reference: R|/J.foo|' type=IrErrorType GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/J.foo|' type=IrErrorType + ERROR_CALL 'Unresolved reference: #' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.txt index 8470958f34b..26594181b3b 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.txt @@ -28,61 +28,58 @@ FILE fqName: fileName:/kt30020.kt $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 IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.MutableList [val] - CALL 'public abstract fun f (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null + 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 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 - SET_VAR 'val tmp_0: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - CONST Int type=kotlin.collections.MutableList value=2 - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.MutableList [val] - TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList - CALL 'public abstract fun (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null + element: CONST Int type=kotlin.Int value=2 + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList + 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 - SET_VAR 'val tmp_1: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - CONST Int type=kotlin.collections.MutableList value=3 - VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.collections.MutableList [val] - TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList + element: CONST Int type=kotlin.Int value=3 + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList 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 - SET_VAR 'val tmp_2: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - CONST Int type=kotlin.collections.MutableList value=4 - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.MutableList [val] - BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.MutableList [val] + element: CONST Int type=kotlin.Int value=4 + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.MutableList [val] CALL 'public abstract fun (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null $this: GET_VAR 'nx: .X? declared in .test' type=.X? origin=null WHEN type=kotlin.collections.MutableList origin=EXCLEXCL 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 - arg0: GET_VAR 'val tmp_4: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + arg0: GET_VAR 'val tmp_0: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: THROW type=kotlin.Nothing CONSTRUCTOR_CALL 'public constructor () declared in kotlin.KotlinNullPointerException' type=kotlin.KotlinNullPointerException origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val tmp_4: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - SET_VAR 'val tmp_3: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - CONST Int type=kotlin.collections.MutableList value=5 - VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.collections.MutableList [val] - BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL - VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlin.collections.MutableList? [val] + then: GET_VAR 'val tmp_0: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + element: CONST Int type=kotlin.Int value=5 + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL + VAR IR_TEMPORARY_VARIABLE name:tmp_1 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 'nx: .X? declared in .test' type=.X origin=null WHEN type=kotlin.collections.MutableList origin=EXCLEXCL 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 - arg0: GET_VAR 'val tmp_6: kotlin.collections.MutableList? [val] declared in .test' type=kotlin.collections.MutableList? origin=null + arg0: GET_VAR 'val tmp_1: kotlin.collections.MutableList? [val] declared in .test' type=kotlin.collections.MutableList? origin=null arg1: CONST Null type=kotlin.Nothing? value=null then: THROW type=kotlin.Nothing CONSTRUCTOR_CALL 'public constructor () declared in kotlin.KotlinNullPointerException' type=kotlin.KotlinNullPointerException origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val tmp_6: kotlin.collections.MutableList? [val] declared in .test' type=kotlin.collections.MutableList origin=null - SET_VAR 'val tmp_5: kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - CONST Int type=kotlin.collections.MutableList value=6 + then: GET_VAR 'val tmp_1: kotlin.collections.MutableList? [val] declared in .test' type=kotlin.collections.MutableList origin=null + element: CONST Int type=kotlin.Int value=6 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_EXPR 'Operator overload ambiguity. Compatible candidates: [kotlin/collections/plus, kotlin/collections/plusAssign]' type=IrErrorType + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: GET_VAR ': kotlin.collections.MutableList declared in .testExtensionReceiver' type=kotlin.collections.MutableList origin=null + element: CONST Int type=kotlin.Int value=100 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] @@ -92,7 +89,9 @@ 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_EXPR 'Operator overload ambiguity. Compatible candidates: [kotlin/collections/plus, kotlin/collections/plusAssign]' type=IrErrorType + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: GET_VAR ': .AML declared in .AML' type=.AML origin=null + element: CONST Int type=kotlin.Int value=200 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] @@ -102,7 +101,9 @@ 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_EXPR 'Operator overload ambiguity. Compatible candidates: [kotlin/collections/plus, kotlin/collections/plusAssign]' type=IrErrorType + CALL 'public final fun plusAssign (element: T of ): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null + $receiver: GET_VAR ': .AML declared in .AML' type=.AML origin=null + element: CONST Int type=kotlin.Int value=300 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any