[IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
This commit is contained in:
+6
@@ -25170,6 +25170,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/objects/kt42758.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ abstract class IrDeclarationReference : IrExpression() {
|
||||
|
||||
abstract class IrGetSingletonValue : IrDeclarationReference()
|
||||
|
||||
abstract class IrGetObjectValue : IrGetSingletonValue() {
|
||||
abstract class IrGetObjectValue : IrGetSingletonValue(), IrExpressionWithCopy {
|
||||
abstract override val symbol: IrClassSymbol
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrGetObjectValue
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -29,4 +30,8 @@ class IrGetObjectValueImpl(
|
||||
) : IrGetObjectValue() {
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitGetObjectValue(this, data)
|
||||
|
||||
override fun copy(): IrExpression {
|
||||
return IrGetObjectValueImpl(startOffset, endOffset, type, symbol)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
object A {
|
||||
var id = 0
|
||||
get() = field.also { field++ }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (A.id != 0) return "FAIL1"
|
||||
if (A.id != 1) return "FAIL2"
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -25170,6 +25170,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/objects/kt42758.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
|
||||
+6
@@ -25170,6 +25170,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/objects/kt42758.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
|
||||
+5
@@ -21371,6 +21371,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/objects/kt42758.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt535.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -16844,6 +16844,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/objects/kt4086.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt535.kt");
|
||||
|
||||
Generated
+5
@@ -16301,6 +16301,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/objects/kt4086.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt535.kt");
|
||||
|
||||
Generated
+5
@@ -16366,6 +16366,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/objects/kt4086.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt535.kt")
|
||||
public void testKt535() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt535.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -10157,6 +10157,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/objects/kt4086.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45170.kt")
|
||||
public void testKt45170() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt45170.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt694.kt")
|
||||
public void testKt694() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/objects/kt694.kt");
|
||||
|
||||
Reference in New Issue
Block a user