[FIR] Don't generated fake-overrides for private declarations of actualized super classes
^KT-58252 Fixed
This commit is contained in:
committed by
Space Team
parent
cfa481d38f
commit
e9c8be3b64
+6
@@ -33170,6 +33170,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -33170,6 +33170,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.backend.common.actualizer
|
||||
|
||||
import org.jetbrains.kotlin.KtDiagnosticReporterWithImplicitIrBasedContext
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendErrors
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildProperty
|
||||
@@ -67,6 +68,7 @@ internal class MissingFakeOverridesAdder(
|
||||
val actualClass = expectActualMap[expectClass.symbol]?.owner as? IrClass ?: continue
|
||||
for (actualMember in actualClass.declarations) {
|
||||
if (actualMember.isBuiltinMember() || actualMember in added) continue
|
||||
if ((actualMember as? IrDeclarationWithVisibility)?.visibility == DescriptorVisibilities.PRIVATE) continue
|
||||
addFakeOverride(actualMember, members, declaration)
|
||||
}
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// LANGUAGE: +MultiPlatformProjects
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6
|
||||
// JS tests don't support MPP modules compilation
|
||||
// ISSUE: KT-58252
|
||||
|
||||
// MODULE: lib-common
|
||||
// FILE: common.kt
|
||||
|
||||
package foo
|
||||
|
||||
interface Base<T : Any> {
|
||||
val capacity: Int
|
||||
}
|
||||
|
||||
expect abstract class Derived<T : Any>(capacity: Int) : Base<T> {
|
||||
final override val capacity: Int
|
||||
}
|
||||
|
||||
internal val ByteArrayPool = object : Derived<ByteArray>(128) {}
|
||||
|
||||
// MODULE: lib()()(lib-common)
|
||||
// FILE: platform.kt
|
||||
|
||||
package foo
|
||||
|
||||
actual abstract class Derived<T : Any>
|
||||
actual constructor(actual final override val capacity: Int) : Base<T> {
|
||||
private val instances = arrayOfNulls<Any?>(capacity)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (ByteArrayPool.capacity == 128) "OK" else "Error: ${ByteArrayPool.capacity}"
|
||||
}
|
||||
+6
@@ -31700,6 +31700,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -33170,6 +33170,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -33170,6 +33170,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+5
@@ -27020,6 +27020,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+6
@@ -23156,6 +23156,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -23294,6 +23294,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -23294,6 +23294,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -23294,6 +23294,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -26676,6 +26676,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -27278,6 +27278,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -26375,6 +26375,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -26977,6 +26977,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+5
@@ -20723,6 +20723,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectAndSpecificImplementationInDeserializedIr.kt")
|
||||
public void testAnonymousObjectAndSpecificImplementationInDeserializedIr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user