diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 254fa10ece8..ebecbcf4df4 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -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") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 64f6d47efdf..21eb59d385a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -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") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 50cf1150cfe..2c52346ed74 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -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") diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt index a262f8c303a..09e0c077c18 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolver.kt @@ -40,6 +40,7 @@ class FirStatusResolver( FirDeclarationStatusImpl.Modifier.CONST, FirDeclarationStatusImpl.Modifier.LATEINIT, FirDeclarationStatusImpl.Modifier.TAILREC, + FirDeclarationStatusImpl.Modifier.EXTERNAL, ) private val MODIFIERS_FROM_OVERRIDDEN: List = diff --git a/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt b/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt new file mode 100644 index 00000000000..24701f8334a --- /dev/null +++ b/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.kt @@ -0,0 +1,10 @@ +// FIR_IDENTICAL +open class A { + open external fun foo() +} + +class B : A() { + override fun foo() { + super.foo() + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.txt b/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.txt new file mode 100644 index 00000000000..0f4e0d7cf0e --- /dev/null +++ b/compiler/testData/diagnostics/tests/external/noExternalModifierInheritance.txt @@ -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 +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 971ebf4c269..d7112b05409 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -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")