From b792f3f12fc9e6e163a85bf562ed4c6ecb1e0027 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 22 Feb 2019 13:02:24 +0300 Subject: [PATCH] KT-30020 expressions without resolved calls in augmented assignment LHS Augmented assignment operator (e.g., '+=') can be resolved to simple function call ('plusAssign'). In that case, augmented assignment LHS can be an arbitrary expression, and may have no associated ResolvedCall. For example: (a as MutableList) += 42 Note that it can happen only in case of augmented assignment operator convention resolution, because all other forms of assignment-like operator desugaring require some kind of 'store' operation (property setter, 'set' operator for array element expression, etc), and should resolve to some combination of calls. In that case we simply generate LHS on 'load', and throw assertion on 'store'. --- .../psi2ir/generators/AssignmentGenerator.kt | 28 +- .../SpecialExpressionAssignmentReceiver.kt | 34 +++ .../testData/ir/irText/expressions/kt30020.kt | 31 ++ .../ir/irText/expressions/kt30020.txt | 273 ++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 5 files changed, 367 insertions(+), 4 deletions(-) create mode 100644 compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SpecialExpressionAssignmentReceiver.kt create mode 100644 compiler/testData/ir/irText/expressions/kt30020.kt create mode 100644 compiler/testData/ir/irText/expressions/kt30020.txt diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt index fb0dd04fe6b..9c24d3692b4 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AssignmentGenerator.kt @@ -172,15 +172,17 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen return generateArrayAccessAssignmentReceiver(ktLeft, origin) } - val resolvedCall = getResolvedCall(ktLeft) ?: TODO("no resolved call for LHS") + val resolvedCall = getResolvedCall(ktLeft) + ?: return generateExpressionAssignmentReceiver(ktLeft, origin, isAssignmentStatement) val descriptor = resolvedCall.resultingDescriptor + val startOffset = ktLeft.startOffsetSkippingComments + val endOffset = ktLeft.endOffset return when (descriptor) { is SyntheticFieldDescriptor -> { val receiverValue = statementGenerator.generateBackingFieldReceiver( - ktLeft.startOffsetSkippingComments, - ktLeft.endOffset, + startOffset, endOffset, resolvedCall, descriptor ) @@ -191,7 +193,7 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen if (descriptor.isDelegated) DelegatedLocalPropertyLValue( context, - ktLeft.startOffsetSkippingComments, ktLeft.endOffset, + startOffset, endOffset, descriptor.type.toIrType(), descriptor.getter?.let { context.symbolTable.referenceDeclaredFunction(it) }, descriptor.setter?.let { context.symbolTable.referenceDeclaredFunction(it) }, @@ -208,6 +210,24 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen } } + private fun generateExpressionAssignmentReceiver( + ktLeft: KtExpression, + origin: IrStatementOrigin, + isAssignmentStatement: Boolean + ): AssignmentReceiver { + // This is a somewhat special case when LHS of the augmented assignment operator is an arbitrary expression without resolved call. + // This can happen only in case of compound assignment resolved to 'Assign' operator, e.g., + // (a as MutableList) += 42 + if (!isAssignmentStatement) { + throw AssertionError("Arbitrary assignment receiver found in assignment-like expression: ${ktLeft.parent.text}") + } + + return SpecialExpressionAssignmentReceiver( + statementGenerator, ktLeft, origin, + context.bindingContext.getType(ktLeft)?.toIrType() ?: throw AssertionError("No type for expression ${ktLeft.text}") + ) + } + private fun createVariableValue( ktExpression: KtExpression, descriptor: ValueDescriptor, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SpecialExpressionAssignmentReceiver.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SpecialExpressionAssignmentReceiver.kt new file mode 100644 index 00000000000..03cde6af0d7 --- /dev/null +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/SpecialExpressionAssignmentReceiver.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.psi2ir.intermediate + +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.psi.KtExpression +import org.jetbrains.kotlin.psi2ir.generators.StatementGenerator + +class SpecialExpressionAssignmentReceiver( + private val statementGenerator: StatementGenerator, + private val ktExpression: KtExpression, + private val origin: IrStatementOrigin, + override val type: IrType +) : + LValue, + AssignmentReceiver { + + override fun load(): IrExpression = + statementGenerator.generateExpression(ktExpression) + + override fun store(irExpression: IrExpression): IrExpression = + throw AssertionError( + "This is an expression assignment receiver for ${ktExpression.text}, " + + "it can be used only in augmented assignment operator convention for 'Assign'" + ) + + override fun assign(withLValue: (LValue) -> IrExpression): IrExpression = + withLValue(this) +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/kt30020.kt b/compiler/testData/ir/irText/expressions/kt30020.kt new file mode 100644 index 00000000000..a641d6adcf4 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30020.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +interface X { + val xs: MutableList + fun f(): MutableList +} + +fun test(x: X, nx: X?) { + x.xs += 1 + x.f() += 2 + (x.xs as MutableList) += 3 + (x.f() as MutableList) += 4 + nx?.xs!! += 5 + nx?.f()!! += 6 +} + +fun MutableList.testExtensionReceiver() { + this += 100 +} + +abstract class AML : MutableList { + fun testExplicitThis() { + this += 200 + } + + inner class Inner { + fun testOuterThis() { + this@AML += 300 + } + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/kt30020.txt b/compiler/testData/ir/irText/expressions/kt30020.txt new file mode 100644 index 00000000000..6a45ae5d1df --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt30020.txt @@ -0,0 +1,273 @@ +FILE fqName: fileName:/kt30020.kt + CLASS INTERFACE name:X modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:X flags: + PROPERTY name:xs visibility:public modality:ABSTRACT flags:val + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:X) returnType:kotlin.collections.MutableList flags: + correspondingProperty: PROPERTY name:xs visibility:public modality:ABSTRACT flags:val + $this: VALUE_PARAMETER name: type:X flags: + FUN name:f visibility:public modality:ABSTRACT <> ($this:X) returnType:kotlin.collections.MutableList flags: + $this: VALUE_PARAMETER name: type:X flags: + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN name:test visibility:public modality:FINAL <> (x:X, nx:X?) returnType:kotlin.Unit flags: + VALUE_PARAMETER name:x index:0 type:X flags: + VALUE_PARAMETER name:nx index:1 type:X? flags: + BLOCK_BODY + BLOCK type=kotlin.Unit origin=PLUSEQ + VAR IR_TEMPORARY_VARIABLE name:tmp0_this type:X flags:val + GET_VAR 'value-parameter x: X' type=X origin=null + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: CALL '(): MutableList' type=kotlin.collections.MutableList origin=PLUSEQ + $this: GET_VAR 'tmp0_this: X' type=X origin=null + element: CONST Int type=kotlin.Int value=1 + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: CALL 'f(): MutableList' type=kotlin.collections.MutableList origin=null + $this: GET_VAR 'value-parameter x: X' type=X origin=null + element: CONST Int type=kotlin.Int value=2 + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB INTERFACE name:MutableList modality:ABSTRACT visibility:public flags: superTypes:[kotlin.collections.List; kotlin.collections.MutableCollection] + CALL '(): MutableList' type=kotlin.collections.MutableList origin=GET_PROPERTY + $this: GET_VAR 'value-parameter x: X' type=X origin=null + element: CONST Int type=kotlin.Int value=3 + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB INTERFACE name:MutableList modality:ABSTRACT visibility:public flags: superTypes:[kotlin.collections.List; kotlin.collections.MutableCollection] + CALL 'f(): MutableList' type=kotlin.collections.MutableList origin=null + $this: GET_VAR 'value-parameter x: X' type=X origin=null + element: CONST Int type=kotlin.Int value=4 + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL + VAR IR_TEMPORARY_VARIABLE name:tmp2_notnull type:kotlin.collections.MutableList? flags:val + BLOCK type=kotlin.collections.MutableList? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:X? flags:val + GET_VAR 'value-parameter nx: X?' type=X? origin=null + WHEN type=kotlin.collections.MutableList? origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp1_safe_receiver: X?' type=X? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL '(): MutableList' type=kotlin.collections.MutableList origin=GET_PROPERTY + $this: GET_VAR 'tmp1_safe_receiver: X?' type=X? origin=null + WHEN type=kotlin.collections.MutableList origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp2_notnull: MutableList?' type=kotlin.collections.MutableList? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'tmp2_notnull: MutableList?' type=kotlin.collections.MutableList? origin=null + element: CONST Int type=kotlin.Int value=5 + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL + VAR IR_TEMPORARY_VARIABLE name:tmp4_notnull type:kotlin.collections.MutableList? flags:val + BLOCK type=kotlin.collections.MutableList? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp3_safe_receiver type:X? flags:val + GET_VAR 'value-parameter nx: X?' type=X? origin=null + WHEN type=kotlin.collections.MutableList? origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp3_safe_receiver: X?' type=X? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'f(): MutableList' type=kotlin.collections.MutableList origin=null + $this: GET_VAR 'tmp3_safe_receiver: X?' type=X? origin=null + WHEN type=kotlin.collections.MutableList origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp4_notnull: MutableList?' type=kotlin.collections.MutableList? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'tmp4_notnull: MutableList?' 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 flags: + $receiver: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + BLOCK_BODY + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: GET_VAR 'this@testExtensionReceiver: MutableList' type=kotlin.collections.MutableList origin=PLUSEQ + element: CONST Int type=kotlin.Int value=100 + CLASS CLASS name:AML modality:ABSTRACT visibility:public flags: superTypes:[kotlin.collections.MutableList] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:AML flags: + CONSTRUCTOR visibility:public <> () returnType:AML flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='AML' + FUN name:testExplicitThis visibility:public modality:FINAL <> ($this:AML) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:AML flags: + BLOCK_BODY + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: GET_VAR 'this@AML: AML' type=AML origin=PLUSEQ + element: CONST Int type=kotlin.Int value=200 + CLASS CLASS name:Inner modality:FINAL visibility:public flags:inner superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:AML.Inner flags: + CONSTRUCTOR visibility:public <> ($this:AML) returnType:AML.Inner flags:primary + $outer: VALUE_PARAMETER name: type:AML flags: + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Inner' + FUN name:testOuterThis visibility:public modality:FINAL <> ($this:AML.Inner) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:AML.Inner flags: + BLOCK_BODY + CALL 'plusAssign(T) on MutableCollection: Unit' type=kotlin.Unit origin=PLUSEQ + : kotlin.Int + $receiver: GET_VAR 'this@AML: AML' type=AML origin=PLUSEQ + 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 flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN FAKE_OVERRIDE name:add visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, element:kotlin.Int) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:add visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, element:E) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:element index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:add visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, element:kotlin.Int) returnType:kotlin.Unit flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:add visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, element:E) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + VALUE_PARAMETER name:element index:1 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:addAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:addAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection flags: + FUN FAKE_OVERRIDE name:addAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:addAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + VALUE_PARAMETER name:elements index:1 type:kotlin.collections.Collection flags: + FUN FAKE_OVERRIDE name:clear visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList) returnType:kotlin.Unit flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:clear visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + FUN FAKE_OVERRIDE name:contains visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:kotlin.Int) returnType:kotlin.Boolean flags: + overridden: + FUN FAKE_OVERRIDE name:contains visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:E) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + VALUE_PARAMETER name:element index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:containsAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + overridden: + FUN FAKE_OVERRIDE name:containsAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection flags: + FUN FAKE_OVERRIDE name:get visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, index:kotlin.Int) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:get visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, index:kotlin.Int) returnType:E flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:indexOf visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:kotlin.Int) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:indexOf visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:E) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + VALUE_PARAMETER name:element index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List) returnType:kotlin.Boolean flags: + overridden: + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + FUN FAKE_OVERRIDE name:iterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableCollection) returnType:kotlin.collections.MutableIterator flags: + overridden: + FUN FAKE_OVERRIDE name:iterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableCollection) returnType:kotlin.collections.MutableIterator flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableCollection flags: + FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:kotlin.Int) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List, element:E) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + VALUE_PARAMETER name:element index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:listIterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList) returnType:kotlin.collections.MutableListIterator flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:listIterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList) returnType:kotlin.collections.MutableListIterator flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + FUN FAKE_OVERRIDE name:listIterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int) returnType:kotlin.collections.MutableListIterator flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:listIterator visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int) returnType:kotlin.collections.MutableListIterator flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:remove visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, element:kotlin.Int) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:remove visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, element:E) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:element index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:removeAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:removeAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection flags: + FUN FAKE_OVERRIDE name:removeAt visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:removeAt visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int) returnType:E flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:retainAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:retainAll visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, elements:kotlin.collections.Collection) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection flags: + FUN FAKE_OVERRIDE name:set visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, element:kotlin.Int) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:set visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, index:kotlin.Int, element:E) returnType:E flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:index index:0 type:kotlin.Int flags: + VALUE_PARAMETER name:element index:1 type:kotlin.Int flags: + FUN FAKE_OVERRIDE name:subList visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, fromIndex:kotlin.Int, toIndex:kotlin.Int) returnType:kotlin.collections.MutableList flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:subList visibility:public modality:ABSTRACT <> ($this:kotlin.collections.MutableList, fromIndex:kotlin.Int, toIndex:kotlin.Int) returnType:kotlin.collections.MutableList flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableList flags: + VALUE_PARAMETER name:fromIndex index:0 type:kotlin.Int flags: + VALUE_PARAMETER name:toIndex index:1 type:kotlin.Int flags: + PROPERTY FAKE_OVERRIDE name:size visibility:public modality:ABSTRACT flags:val + FUN FAKE_OVERRIDE name: visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:ABSTRACT flags:val + overridden: + FUN FAKE_OVERRIDE name: visibility:public modality:ABSTRACT <> ($this:kotlin.collections.List) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.collections.List flags: + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + overridden: + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + overridden: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 4756ea4080f..9db9c1d7bfa 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -987,6 +987,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/kt28456b.kt"); } + @TestMetadata("kt30020.kt") + public void testKt30020() throws Exception { + runTest("compiler/testData/ir/irText/expressions/kt30020.kt"); + } + @TestMetadata("lambdaInCAO.kt") public void testLambdaInCAO() throws Exception { runTest("compiler/testData/ir/irText/expressions/lambdaInCAO.kt");