JVM_IR KT-48295 don't upcast field receiver with super qualifier
This commit is contained in:
committed by
TeamCityServer
parent
7038b02933
commit
a3bb9dde45
+12
@@ -24782,6 +24782,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295.kt")
|
||||||
|
public void testKt48295() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295a.kt")
|
||||||
|
public void testKt48295a() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295a.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("publicField.kt")
|
@TestMetadata("publicField.kt")
|
||||||
public void testPublicField() throws Exception {
|
public void testPublicField() throws Exception {
|
||||||
|
|||||||
+3
-1
@@ -116,7 +116,9 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
|||||||
val receiver = expression.dispatchReceiver
|
val receiver = expression.dispatchReceiver
|
||||||
if (receiver != null) {
|
if (receiver != null) {
|
||||||
val propertyParent = irProperty.parent
|
val propertyParent = irProperty.parent
|
||||||
if (propertyParent is IrClass && propertyParent.symbol != receiver.type.classifierOrNull) {
|
if (propertyParent is IrClass && propertyParent.symbol != receiver.type.classifierOrNull &&
|
||||||
|
expression.superQualifierSymbol == null
|
||||||
|
) {
|
||||||
return irImplicitCast(receiver, propertyParent.defaultType)
|
return irImplicitCast(receiver, propertyParent.defaultType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
// FILE: a.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
@JvmField protected var result = "Fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
class B : a.A() {
|
||||||
|
fun test(): String {
|
||||||
|
super.result = "OK"
|
||||||
|
return super.result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = B().test()
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
// FILE: a.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
@JvmField protected var result = "Fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
open class AA : A()
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
class B : a.AA() {
|
||||||
|
fun test(): String {
|
||||||
|
super.result = "OK"
|
||||||
|
return super.result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = B().test()
|
||||||
+12
@@ -24632,6 +24632,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295.kt")
|
||||||
|
public void testKt48295() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295a.kt")
|
||||||
|
public void testKt48295a() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295a.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("publicField.kt")
|
@TestMetadata("publicField.kt")
|
||||||
public void testPublicField() throws Exception {
|
public void testPublicField() throws Exception {
|
||||||
|
|||||||
+12
@@ -24782,6 +24782,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295.kt")
|
||||||
|
public void testKt48295() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt48295a.kt")
|
||||||
|
public void testKt48295a() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295a.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("publicField.kt")
|
@TestMetadata("publicField.kt")
|
||||||
public void testPublicField() throws Exception {
|
public void testPublicField() throws Exception {
|
||||||
|
|||||||
+10
@@ -20763,6 +20763,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
runTest("compiler/testData/codegen/box/jvmField/kt47739.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48295.kt")
|
||||||
|
public void testKt48295() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt48295a.kt")
|
||||||
|
public void testKt48295a() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvmField/kt48295a.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("publicField.kt")
|
@TestMetadata("publicField.kt")
|
||||||
public void testPublicField() throws Exception {
|
public void testPublicField() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/jvmField/publicField.kt");
|
runTest("compiler/testData/codegen/box/jvmField/publicField.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user