From bab00255dce5eb52c4d6093a496d1d483c06ff03 Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Wed, 13 Sep 2023 11:10:25 +0000 Subject: [PATCH] [K/N, Tests] Add diagnostic tests for SUPER_CALL_WITH_DEFAULT_PARAMETERS ^KT-61572 Merge-request: KT-MR-11941 Merged-by: Vladimir Sukharev --- ...DiagnosticsWithLightTreeTestGenerated.java | 6 +++++ ...endMPPDiagnosticsWithPsiTestGenerated.java | 6 +++++ .../superCallDefaultArguments.fir.kt | 22 +++++++++++++++++++ .../superCallDefaultArguments.kt | 22 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 +++++ 5 files changed, 62 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt 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 878849d7042..1f33cef8761 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 @@ -325,6 +325,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/smartcastOnMemberPropertyFromCommonClass.kt"); } + @Test + @TestMetadata("superCallDefaultArguments.kt") + public void testSuperCallDefaultArguments() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt"); + } + @Test @TestMetadata("supertypeActualizationWithAny.kt") public void testSupertypeActualizationWithAny() throws Exception { 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 b732d48928c..148f4d8a9ad 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 @@ -325,6 +325,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/smartcastOnMemberPropertyFromCommonClass.kt"); } + @Test + @TestMetadata("superCallDefaultArguments.kt") + public void testSuperCallDefaultArguments() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt"); + } + @Test @TestMetadata("supertypeActualizationWithAny.kt") public void testSupertypeActualizationWithAny() throws Exception { diff --git a/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.fir.kt new file mode 100644 index 00000000000..abc6aca32d9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.fir.kt @@ -0,0 +1,22 @@ +// KT-61572: SUPER_CALL_WITH_DEFAULT_PARAMETERS must be raised for K2/Native in fun bar1() +// !LANGUAGE: +MultiPlatformProjects +// MODULE: m1-common +// FILE: common.kt + +package foo +expect open class A { + open fun foo(x: Int = 20, y: Int = 3): Int +} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +package foo +actual open class A { + actual open fun foo(x: Int, y: Int) = x + y +} + +open class B : A() { + override fun foo(x: Int, y: Int) = 0 + + fun bar1() = super.foo() +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt b/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt new file mode 100644 index 00000000000..0eb476799c1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt @@ -0,0 +1,22 @@ +// KT-61572: SUPER_CALL_WITH_DEFAULT_PARAMETERS must be raised for K2/Native in fun bar1() +// !LANGUAGE: +MultiPlatformProjects +// MODULE: m1-common +// FILE: common.kt + +package foo +expect open class A { + open fun foo(x: Int = 20, y: Int = 3): Int +} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +package foo +actual open class A { + actual open fun foo(x: Int, y: Int) = x + y +} + +open class B : A() { + override fun foo(x: Int, y: Int) = 0 + + fun bar1() = super.foo() +} 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 dfea076a40b..71bb331ed66 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 @@ -23320,6 +23320,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/smartcastOnMemberPropertyFromCommonClass.kt"); } + @Test + @TestMetadata("superCallDefaultArguments.kt") + public void testSuperCallDefaultArguments() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/superCallDefaultArguments.kt"); + } + @Test @TestMetadata("supertypeActualizationWithAny.kt") public void testSupertypeActualizationWithAny() throws Exception {