FIR: do not inherit external modifier from super declaration

This commit is contained in:
Ilya Kirillov
2021-11-04 19:23:56 +01:00
parent d119976b46
commit 348403b1f3
7 changed files with 92 additions and 0 deletions
@@ -10550,6 +10550,22 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/external")
@TestDataPath("$PROJECT_ROOT")
public class External {
@Test
public void testAllFilesPresentInExternal() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/external"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("noExternalModifierInheritance.kt")
public void testNoExternalModifierInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/funInterface")
@TestDataPath("$PROJECT_ROOT")
@@ -10550,6 +10550,22 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/external")
@TestDataPath("$PROJECT_ROOT")
public class External {
@Test
public void testAllFilesPresentInExternal() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/external"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("noExternalModifierInheritance.kt")
public void testNoExternalModifierInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/funInterface")
@TestDataPath("$PROJECT_ROOT")
@@ -10550,6 +10550,22 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/external")
@TestDataPath("$PROJECT_ROOT")
public class External {
@Test
public void testAllFilesPresentInExternal() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/external"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("noExternalModifierInheritance.kt")
public void testNoExternalModifierInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/funInterface")
@TestDataPath("$PROJECT_ROOT")
@@ -40,6 +40,7 @@ class FirStatusResolver(
FirDeclarationStatusImpl.Modifier.CONST,
FirDeclarationStatusImpl.Modifier.LATEINIT,
FirDeclarationStatusImpl.Modifier.TAILREC,
FirDeclarationStatusImpl.Modifier.EXTERNAL,
)
private val MODIFIERS_FROM_OVERRIDDEN: List<FirDeclarationStatusImpl.Modifier> =
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
open class A {
open external fun foo()
}
class B : A() {
override fun foo() {
super.foo()
}
}
@@ -0,0 +1,17 @@
package
public open class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open external fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class B : A {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -10556,6 +10556,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/external")
@TestDataPath("$PROJECT_ROOT")
public class External {
@Test
public void testAllFilesPresentInExternal() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/external"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("noExternalModifierInheritance.kt")
public void testNoExternalModifierInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/funInterface")
@TestDataPath("$PROJECT_ROOT")