JVM_IR: generate accessors for inherited abstract members too
#KT-41468 Fixed
This commit is contained in:
Generated
+5
@@ -30591,6 +30591,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
+1
-1
@@ -576,7 +576,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
|
||||
val symbolOwner = owner
|
||||
val declarationRaw = symbolOwner as IrDeclarationWithVisibility
|
||||
val declaration =
|
||||
(declarationRaw as? IrSimpleFunction)?.resolveFakeOverride() ?: declarationRaw
|
||||
(declarationRaw as? IrSimpleFunction)?.resolveFakeOverride(allowAbstract = true) ?: declarationRaw
|
||||
|
||||
// There is never a problem with visibility of inline functions, as those don't end up as Java entities
|
||||
if (declaration is IrFunction && declaration.isInline) return true
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: 1.kt
|
||||
import a.*
|
||||
|
||||
abstract class B : A() {
|
||||
fun g() = { f() }()
|
||||
}
|
||||
|
||||
fun box() = object : B() {
|
||||
override fun f(): String = "OK"
|
||||
}.g()
|
||||
|
||||
// FILE: 2.kt
|
||||
package a
|
||||
|
||||
abstract class A {
|
||||
protected abstract fun f(): String
|
||||
}
|
||||
+5
@@ -32357,6 +32357,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
+5
@@ -29991,6 +29991,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
+5
@@ -30591,6 +30591,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
Generated
+5
@@ -24872,6 +24872,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
Generated
+5
@@ -24872,6 +24872,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
+5
@@ -24887,6 +24887,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForAbstractProtected.kt")
|
||||
public void testAccessorForAbstractProtected() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForAbstractProtected.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("accessorForGenericConstructor.kt")
|
||||
public void testAccessorForGenericConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt");
|
||||
|
||||
Reference in New Issue
Block a user