diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index d24aa9d02e5..0caf1cd052e 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -26586,6 +26586,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/scopes") @TestDataPath("$PROJECT_ROOT") public class Scopes { + @Test + @TestMetadata("actualAbstractClassWithAdditionalMembers.kt") + public void testActualAbstractClassWithAdditionalMembers() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt"); + } + @Test @TestMetadata("actualFakeOverride.kt") public void testActualFakeOverride() throws Exception { @@ -26675,11 +26681,29 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt"); } + @Test + @TestMetadata("mixedFunctionalTypesInSupertypes.kt") + public void testMixedFunctionalTypesInSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt"); + } + + @Test + @TestMetadata("multipleDefaultsInhereted.kt") + public void testMultipleDefaultsInhereted() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt"); + } + @Test @TestMetadata("multipleExpectInterfacesImplementation.kt") public void testMultipleExpectInterfacesImplementation() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleExpectInterfacesImplementation.kt"); } + + @Test + @TestMetadata("scopeOfFunInterface.kt") + public void testScopeOfFunInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt"); + } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 9146a152753..1cb40a16e52 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -26586,6 +26586,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/scopes") @TestDataPath("$PROJECT_ROOT") public class Scopes { + @Test + @TestMetadata("actualAbstractClassWithAdditionalMembers.kt") + public void testActualAbstractClassWithAdditionalMembers() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt"); + } + @Test @TestMetadata("actualFakeOverride.kt") public void testActualFakeOverride() throws Exception { @@ -26675,11 +26681,29 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt"); } + @Test + @TestMetadata("mixedFunctionalTypesInSupertypes.kt") + public void testMixedFunctionalTypesInSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt"); + } + + @Test + @TestMetadata("multipleDefaultsInhereted.kt") + public void testMultipleDefaultsInhereted() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt"); + } + @Test @TestMetadata("multipleExpectInterfacesImplementation.kt") public void testMultipleExpectInterfacesImplementation() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleExpectInterfacesImplementation.kt"); } + + @Test + @TestMetadata("scopeOfFunInterface.kt") + public void testScopeOfFunInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt"); + } } @Nested diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java index e01d51b6bcb..846b2f432d0 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java @@ -1935,6 +1935,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/scopes") @TestDataPath("$PROJECT_ROOT") public class Scopes { + @Test + @TestMetadata("actualAbstractClassWithAdditionalMembers.kt") + public void testActualAbstractClassWithAdditionalMembers() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt"); + } + @Test @TestMetadata("actualFakeOverride.kt") public void testActualFakeOverride() throws Exception { @@ -2024,11 +2030,29 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt"); } + @Test + @TestMetadata("mixedFunctionalTypesInSupertypes.kt") + public void testMixedFunctionalTypesInSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt"); + } + + @Test + @TestMetadata("multipleDefaultsInhereted.kt") + public void testMultipleDefaultsInhereted() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt"); + } + @Test @TestMetadata("multipleExpectInterfacesImplementation.kt") public void testMultipleExpectInterfacesImplementation() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleExpectInterfacesImplementation.kt"); } + + @Test + @TestMetadata("scopeOfFunInterface.kt") + public void testScopeOfFunInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt"); + } } @Nested diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java index 72909eefdfa..9d7e930d8d5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java @@ -1935,6 +1935,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/scopes") @TestDataPath("$PROJECT_ROOT") public class Scopes { + @Test + @TestMetadata("actualAbstractClassWithAdditionalMembers.kt") + public void testActualAbstractClassWithAdditionalMembers() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt"); + } + @Test @TestMetadata("actualFakeOverride.kt") public void testActualFakeOverride() throws Exception { @@ -2024,11 +2030,29 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt"); } + @Test + @TestMetadata("mixedFunctionalTypesInSupertypes.kt") + public void testMixedFunctionalTypesInSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt"); + } + + @Test + @TestMetadata("multipleDefaultsInhereted.kt") + public void testMultipleDefaultsInhereted() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt"); + } + @Test @TestMetadata("multipleExpectInterfacesImplementation.kt") public void testMultipleExpectInterfacesImplementation() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleExpectInterfacesImplementation.kt"); } + + @Test + @TestMetadata("scopeOfFunInterface.kt") + public void testScopeOfFunInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt"); + } } @Nested diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt new file mode 100644 index 00000000000..79494ad1d94 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt @@ -0,0 +1,23 @@ +// FIR_IDENTICAL +// TARGET_BACKEND: JVM +// LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-64187 + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt +expect abstract class Base + +expect class Derived : Base + +// MODULE: jvm()()(common) +// TARGET_PLATFORM: JVM +// FILE: main.kt + +actual abstract class Base { + abstract fun foo() +} + +actual class Derived : Base() { + override fun foo() {} +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt index eb17c078219..7bf6a31fb27 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.fir.kt @@ -1,24 +1,29 @@ // TARGET_BACKEND: JVM -// !LANGUAGE: +MultiPlatformProjects +// LANGUAGE: +MultiPlatformProjects -// MODULE: common -// TARGET_PLATFORM: Common +// MODULE: m1-common // FILE: common.kt expect open class C1() expect interface I1 -open class A : C1(), I1 -open class B : I1, C1() +open class Common1_1 : C1(), I1 +open class Common1_2 : I1, C1() + +expect open class Expect1_1 : C1, I1 +expect open class Expect1_2 : I1, C1 + expect abstract class C2() expect interface I2 -// TODO: KT-58829 -class C : C2(), I2 +open class Common2_1 : C2(), I2 +open class Common2_2 : I2, C2() -// MODULE: jvm()()(common) -// TARGET_PLATFORM: JVM +expect open class Expect2_1 : C2, I2 +expect open class Expect2_2 : I2, C2 + +// MODULE: m1-jvm()()(m1-common) // FILE: main.kt actual open class C1 { @@ -29,6 +34,10 @@ actual interface I1 { fun f() {} } +actual open class Expect1_1 : C1(), I1 +actual open class Expect1_2 : I1, C1() + + actual abstract class C2 actual constructor() { fun g() {} } @@ -36,3 +45,6 @@ actual abstract class C2 actual constructor() { actual interface I2 { fun g() } + +actual open class Expect2_1 : C2(), I2 +actual open class Expect2_2 : I2, C2() diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt index 93f11e84637..91ead3474b5 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/manyImplMemberNotImplemented.kt @@ -1,24 +1,29 @@ // TARGET_BACKEND: JVM -// !LANGUAGE: +MultiPlatformProjects +// LANGUAGE: +MultiPlatformProjects -// MODULE: common -// TARGET_PLATFORM: Common +// MODULE: m1-common // FILE: common.kt expect open class C1() expect interface I1 -open class A : C1(), I1 -open class B : I1, C1() +open class Common1_1 : C1(), I1 +open class Common1_2 : I1, C1() + +expect open class Expect1_1 : C1, I1 +expect open class Expect1_2 : I1, C1 + expect abstract class C2() expect interface I2 -// TODO: KT-58829 -class C : C2(), I2 +open class Common2_1 : C2(), I2 +open class Common2_2 : I2, C2() -// MODULE: jvm()()(common) -// TARGET_PLATFORM: JVM +expect open class Expect2_1 : C2, I2 +expect open class Expect2_2 : I2, C2 + +// MODULE: m1-jvm()()(m1-common) // FILE: main.kt actual open class C1 { @@ -29,6 +34,10 @@ actual interface I1 { fun f() {} } +actual open class Expect1_1 : C1(), I1 +actual open class Expect1_2 : I1, C1() + + actual abstract class C2 actual constructor() { fun g() {} } @@ -36,3 +45,6 @@ actual abstract class C2 actual constructor() { actual interface I2 { fun g() } + +actual open class Expect2_1 : C2(), I2 +actual open class Expect2_2 : I2, C2() diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt new file mode 100644 index 00000000000..e0ad087f345 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.fir.kt @@ -0,0 +1,23 @@ +// LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt +expect interface I1 { + fun invoke(): R +} + +expect interface I2 { + suspend fun invoke(): R +} + +expect interface ExpectInterface : I1, I2 + +interface CommonInterface : I1, I2 + +// MODULE: jvm()()(common) +// FILE: main.kt + +actual typealias I1 = () -> R +actual typealias I2 = suspend () -> R + +actual interface ExpectInterface : I1, I2 diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt new file mode 100644 index 00000000000..a742cb16622 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt @@ -0,0 +1,23 @@ +// LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt +expect interface I1 { + fun invoke(): R +} + +expect interface I2 { + suspend fun invoke(): R +} + +expect interface ExpectInterface : I1, I2 + +interface CommonInterface : I1, I2 + +// MODULE: jvm()()(common) +// FILE: main.kt + +actual typealias I1 = () -> R +actual typealias I2 = suspend () -> R + +actual interface ExpectInterface : I1, I2 diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt new file mode 100644 index 00000000000..eac07ae21e6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt @@ -0,0 +1,39 @@ +// FIR_IDENTICAL +// LANGUAGE: +MultiPlatformProjects + +// MODULE: m1-common +// FILE: common.kt +expect interface I1 { + fun foo(x: Int = 1) + fun bar(x: Int = 1) +} + +expect interface I2 { + fun foo(x: Int = 2) + fun bar(x: Int = 2) +} + +expect interface ExpectInterface : I1, I2 { + override fun foo(x: Int) +} + +interface CommonInterface : I1, I2 { + override fun foo(x: Int) +} + +// MODULE: m1-jvm()()(m1-common) +// FILE: main.kt + +actual interface I1 { + actual fun foo(x: Int) + actual fun bar(x: Int) +} + +actual interface I2 { + actual fun foo(x: Int) + actual fun bar(x: Int) +} + +actual interface ExpectInterface : I1, I2 { + actual override fun foo(x: Int) +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt new file mode 100644 index 00000000000..f6cf81cc443 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.fir.kt @@ -0,0 +1,17 @@ +// LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-58845 + +// MODULE: common +// FILE: common.kt +expect interface I + +fun interface F : I { + fun foo() +} + +// MODULE: jvm()()(common) +// FILE: main.kt + +actual interface I { + fun bar() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt new file mode 100644 index 00000000000..a2718c6a08a --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt @@ -0,0 +1,17 @@ +// LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-58845 + +// MODULE: common +// FILE: common.kt +expect interface I + +fun interface F : I { + fun foo() +} + +// MODULE: jvm()()(common) +// FILE: main.kt + +actual interface I { + fun bar() +} 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 21328ce9d43..2f37c84b349 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 @@ -26586,6 +26586,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/scopes") @TestDataPath("$PROJECT_ROOT") public class Scopes { + @Test + @TestMetadata("actualAbstractClassWithAdditionalMembers.kt") + public void testActualAbstractClassWithAdditionalMembers() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/actualAbstractClassWithAdditionalMembers.kt"); + } + @Test @TestMetadata("actualFakeOverride.kt") public void testActualFakeOverride() throws Exception { @@ -26675,11 +26681,29 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/manyInterfacesMemberNotImplemented.kt"); } + @Test + @TestMetadata("mixedFunctionalTypesInSupertypes.kt") + public void testMixedFunctionalTypesInSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/mixedFunctionalTypesInSupertypes.kt"); + } + + @Test + @TestMetadata("multipleDefaultsInhereted.kt") + public void testMultipleDefaultsInhereted() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleDefaultsInhereted.kt"); + } + @Test @TestMetadata("multipleExpectInterfacesImplementation.kt") public void testMultipleExpectInterfacesImplementation() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/multipleExpectInterfacesImplementation.kt"); } + + @Test + @TestMetadata("scopeOfFunInterface.kt") + public void testScopeOfFunInterface() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/scopes/scopeOfFunInterface.kt"); + } } @Nested