diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index de3c2737e11..3f3c4a0813d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -30136,6 +30136,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @Test + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @Test + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @Test @TestMetadata("kt613.kt") public void testKt613() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index b577b36c16d..ae88d361776 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -1466,6 +1466,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/expressions/kt48806.kt"); } + @Test + @TestMetadata("kt49203.kt") + public void testKt49203() throws Exception { + runTest("compiler/testData/ir/irText/expressions/kt49203.kt"); + } + @Test @TestMetadata("lambdaInCAO.kt") public void testLambdaInCAO() throws Exception { 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 763ca39521b..5f034b45c28 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 @@ -17,10 +17,7 @@ package org.jetbrains.kotlin.psi2ir.generators import com.intellij.psi.tree.IElementType -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor -import org.jetbrains.kotlin.descriptors.ValueDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor import org.jetbrains.kotlin.ir.builders.irBlock @@ -322,6 +319,7 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen val unwrappedPropertyDescriptor = resultingDescriptor.unwrapPropertyDescriptor() val getterDescriptor = unwrappedPropertyDescriptor.unwrappedGetMethod val setterDescriptor = unwrappedPropertyDescriptor.unwrappedSetMethod + ?.takeUnless { it.visibility == DescriptorVisibilities.INVISIBLE_FAKE } val getterSymbol = getterDescriptor?.let { context.symbolTable.referenceSimpleFunction(it.original) } val setterSymbol = setterDescriptor?.let { context.symbolTable.referenceSimpleFunction(it.original) } diff --git a/compiler/testData/codegen/box/properties/kt49203_lateinit.kt b/compiler/testData/codegen/box/properties/kt49203_lateinit.kt new file mode 100644 index 00000000000..28f20f62c05 --- /dev/null +++ b/compiler/testData/codegen/box/properties/kt49203_lateinit.kt @@ -0,0 +1,25 @@ +class X { + var value = "" + + operator fun plusAssign(data: String) { + value += data + } +} + +abstract class A { + lateinit var x: X + private set + + fun init() { + x = X() + } +} + +class B : A() + +fun box(): String { + val a = B() + a.init() + a.x += "OK" + return a.x.value +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/kt49203_var.kt b/compiler/testData/codegen/box/properties/kt49203_var.kt new file mode 100644 index 00000000000..b5245a6a052 --- /dev/null +++ b/compiler/testData/codegen/box/properties/kt49203_var.kt @@ -0,0 +1,20 @@ +class X { + var value = "" + + operator fun plusAssign(data: String) { + value += data + } +} + +abstract class A { + var x: X = X() + private set +} + +class B : A() + +fun box(): String { + val a = B() + a.x += "OK" + return a.x.value +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/kt49203.fir.ir.txt b/compiler/testData/ir/irText/expressions/kt49203.fir.ir.txt new file mode 100644 index 00000000000..651eace0334 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt49203.fir.ir.txt @@ -0,0 +1,150 @@ +FILE fqName: fileName:/kt49203.kt + CLASS CLASS name:X modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X + CONSTRUCTOR visibility:public <> () returnType:.X [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:X modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:value visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.X) returnType:kotlin.String + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.X + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .X' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private' type=kotlin.String origin=null + receiver: GET_VAR ': .X declared in .X.' type=.X origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.X, :kotlin.String) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name: index:0 type:kotlin.String + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .X declared in .X.' type=.X origin=null + value: GET_VAR ': kotlin.String declared in .X.' type=kotlin.String origin=null + FUN name:plusAssign visibility:public modality:FINAL <> ($this:.X, data:kotlin.String) returnType:kotlin.Unit [operator] + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:data index:0 type:kotlin.String + BLOCK_BODY + CALL 'public final fun (: kotlin.String): kotlin.Unit declared in .X' type=kotlin.Unit origin=EQ + $this: GET_VAR ': .X declared in .X.plusAssign' type=.X origin=null + : CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in .X' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': .X declared in .X.plusAssign' type=.X origin=null + other: GET_VAR 'data: kotlin.String declared in .X.plusAssign' type=kotlin.String origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + CONSTRUCTOR visibility:public <> () returnType:.A [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:.X + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + $this: VALUE_PARAMETER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .X declared in .A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private' type=.X origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.A, :.X) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + $this: VALUE_PARAMETER name: type:.A + VALUE_PARAMETER name: index:0 type:.X + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + value: GET_VAR ': .X declared in .A.' type=.X origin=null + PROPERTY name:y visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .X' type=.X origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:.X + correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .X declared in .A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private' type=.X origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.A, :.X) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.A + VALUE_PARAMETER name: index:0 type:.X + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + value: GET_VAR ': .X declared in .A.' type=.X origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [lateinit,fake_override,var] + overridden: + public final x: .X [lateinit,var] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.A) returnType:.X [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [lateinit,fake_override,var] + overridden: + public final fun (): .X declared in .A + $this: VALUE_PARAMETER name: type:.A + PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,var] + overridden: + public final y: .X [var] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.A) returnType:.X [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,var] + overridden: + public final fun (): .X declared in .A + $this: VALUE_PARAMETER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:test visibility:public modality:FINAL <> (b:.B) returnType:kotlin.Unit + VALUE_PARAMETER name:b index:0 type:.B + BLOCK_BODY + CALL 'public final fun plusAssign (data: kotlin.String): kotlin.Unit [operator] declared in .X' type=kotlin.Unit origin=null + $this: CALL 'public final fun (): .X declared in .A' type=.X origin=GET_PROPERTY + $this: GET_VAR 'b: .B declared in .test' type=.B origin=null + data: CONST String type=kotlin.String value="x" + CALL 'public final fun plusAssign (data: kotlin.String): kotlin.Unit [operator] declared in .X' type=kotlin.Unit origin=null + $this: CALL 'public final fun (): .X declared in .A' type=.X origin=GET_PROPERTY + $this: GET_VAR 'b: .B declared in .test' type=.B origin=null + data: CONST String type=kotlin.String value="y" diff --git a/compiler/testData/ir/irText/expressions/kt49203.ir.txt b/compiler/testData/ir/irText/expressions/kt49203.ir.txt new file mode 100644 index 00000000000..1de17cee30d --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt49203.ir.txt @@ -0,0 +1,159 @@ +FILE fqName: fileName:/kt49203.kt + CLASS CLASS name:X modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X + CONSTRUCTOR visibility:public <> () returnType:.X [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:X modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:value visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.X) returnType:kotlin.String + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.X + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .X' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private' type=kotlin.String origin=null + receiver: GET_VAR ': .X declared in .X.' type=.X origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.X, :kotlin.String) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name: index:0 type:kotlin.String + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .X declared in .X.' type=.X origin=null + value: GET_VAR ': kotlin.String declared in .X.' type=kotlin.String origin=null + FUN name:plusAssign visibility:public modality:FINAL <> ($this:.X, data:kotlin.String) returnType:kotlin.Unit [operator] + $this: VALUE_PARAMETER name: type:.X + VALUE_PARAMETER name:data index:0 type:kotlin.String + BLOCK_BODY + BLOCK type=kotlin.Unit origin=PLUSEQ + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.X [val] + GET_VAR ': .X declared in .X.plusAssign' type=.X origin=null + CALL 'public final fun (: kotlin.String): kotlin.Unit declared in .X' type=kotlin.Unit origin=PLUSEQ + $this: GET_VAR 'val tmp_0: .X [val] declared in .X.plusAssign' type=.X origin=null + : CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUSEQ + $this: CALL 'public final fun (): kotlin.String declared in .X' type=kotlin.String origin=PLUSEQ + $this: GET_VAR 'val tmp_0: .X [val] declared in .X.plusAssign' type=.X origin=null + other: GET_VAR 'data: kotlin.String declared in .X.plusAssign' type=kotlin.String origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + CONSTRUCTOR visibility:public <> () returnType:.A [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:.X + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + $this: VALUE_PARAMETER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .X declared in .A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private' type=.X origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.A, :.X) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [lateinit,var] + $this: VALUE_PARAMETER name: type:.A + VALUE_PARAMETER name: index:0 type:.X + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.X visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + value: GET_VAR ': .X declared in .A.' type=.X origin=null + PROPERTY name:y visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .X' type=.X origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:.X + correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .X declared in .A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private' type=.X origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.A, :.X) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.A + VALUE_PARAMETER name: index:0 type:.X + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:.X visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A.' type=.A origin=null + value: GET_VAR ': .X declared in .A.' type=.X origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [lateinit,fake_override,var] + overridden: + public final x: .X [lateinit,var] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.A) returnType:.X [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [lateinit,fake_override,var] + overridden: + public final fun (): .X declared in .A + $this: VALUE_PARAMETER name: type:.A + PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,var] + overridden: + public final y: .X [var] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.A) returnType:.X [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,var] + overridden: + public final fun (): .X declared in .A + $this: VALUE_PARAMETER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:test visibility:public modality:FINAL <> (b:.B) returnType:kotlin.Unit + VALUE_PARAMETER name:b index:0 type:.B + BLOCK_BODY + BLOCK type=kotlin.Unit origin=PLUSEQ + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.B [val] + GET_VAR 'b: .B declared in .test' type=.B origin=null + CALL 'public final fun plusAssign (data: kotlin.String): kotlin.Unit [operator] declared in .X' type=kotlin.Unit origin=PLUSEQ + $this: CALL 'public final fun (): .X [fake_override] declared in .B' type=.X origin=PLUSEQ + $this: GET_VAR 'val tmp_1: .B [val] declared in .test' type=.B origin=null + data: CONST String type=kotlin.String value="x" + BLOCK type=kotlin.Unit origin=PLUSEQ + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.B [val] + GET_VAR 'b: .B declared in .test' type=.B origin=null + CALL 'public final fun plusAssign (data: kotlin.String): kotlin.Unit [operator] declared in .X' type=kotlin.Unit origin=PLUSEQ + $this: CALL 'public final fun (): .X [fake_override] declared in .B' type=.X origin=PLUSEQ + $this: GET_VAR 'val tmp_2: .B [val] declared in .test' type=.B origin=null + data: CONST String type=kotlin.String value="y" diff --git a/compiler/testData/ir/irText/expressions/kt49203.kt b/compiler/testData/ir/irText/expressions/kt49203.kt new file mode 100644 index 00000000000..00c8bf3a636 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/kt49203.kt @@ -0,0 +1,23 @@ +// SKIP_KT_DUMP + +class X { + var value = "" + + operator fun plusAssign(data: String) { + value += data + } +} + +abstract class A { + lateinit var x: X + private set + + var y: X = X(); private set +} + +class B : A() + +fun test(b: B) { + b.x += "x" + b.y += "y" +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index eb254cfab06..ff43aebfa88 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -29998,6 +29998,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @Test + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @Test + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @Test @TestMetadata("kt613.kt") public void testKt613() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d30d2305317..20d5aa2854c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -30136,6 +30136,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @Test + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @Test + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @Test @TestMetadata("kt613.kt") public void testKt613() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index f2d2f96b6df..8a522e43cc8 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -1466,6 +1466,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/expressions/kt48806.kt"); } + @Test + @TestMetadata("kt49203.kt") + public void testKt49203() throws Exception { + runTest("compiler/testData/ir/irText/expressions/kt49203.kt"); + } + @Test @TestMetadata("lambdaInCAO.kt") public void testLambdaInCAO() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index faf58634c0e..fe45341986d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -25501,6 +25501,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { runTest("compiler/testData/codegen/box/properties/kt613.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java index d092cb3b5de..636067c3b22 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java @@ -1138,6 +1138,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase { runTest("compiler/testData/ir/irText/expressions/kt48806.kt"); } + @TestMetadata("kt49203.kt") + public void testKt49203() throws Exception { + runTest("compiler/testData/ir/irText/expressions/kt49203.kt"); + } + @TestMetadata("lambdaInCAO.kt") public void testLambdaInCAO() throws Exception { runTest("compiler/testData/ir/irText/expressions/lambdaInCAO.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 4db5c4ba63c..f4d6c654df8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -20110,6 +20110,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { runTest("compiler/testData/codegen/box/properties/kt613.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 77f863c2fc0..6949d954c37 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -19516,6 +19516,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { runTest("compiler/testData/codegen/box/properties/kt613.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 7f69511507f..74ee84ccd3a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -19531,6 +19531,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { runTest("compiler/testData/codegen/box/properties/kt613.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 2ad4d711c13..ae69f645588 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -18671,6 +18671,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/properties/kt4383.kt"); } + @TestMetadata("kt49203_lateinit.kt") + public void testKt49203_lateinit() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_lateinit.kt"); + } + + @TestMetadata("kt49203_var.kt") + public void testKt49203_var() throws Exception { + runTest("compiler/testData/codegen/box/properties/kt49203_var.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { runTest("compiler/testData/codegen/box/properties/kt613.kt");