From fcba0ad75e4e5dd1e2179748d5897446ac069a7f Mon Sep 17 00:00:00 2001 From: "Anastasia.Nekrasova" Date: Mon, 10 Jul 2023 16:40:27 +0300 Subject: [PATCH] [Test] Add a test covering for resolution to subsumed members for raw types ^KT-57620 --- ...CompilerTestFE10TestdataTestGenerated.java | 16 ++++++++++ ...sticCompilerFE10TestDataTestGenerated.java | 16 ++++++++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 16 ++++++++++ ...siOldFrontendDiagnosticsTestGenerated.java | 16 ++++++++++ .../diagnostics/tests/rawTypes/kt57620.fir.kt | 29 +++++++++++++++++++ .../diagnostics/tests/rawTypes/kt57620.kt | 29 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 16 ++++++++++ 7 files changed, 138 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt create mode 100644 compiler/testData/diagnostics/tests/rawTypes/kt57620.kt 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 87fc10ef1a9..f0d7729ebea 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 @@ -25675,6 +25675,22 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia } } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/rawTypes") + @TestDataPath("$PROJECT_ROOT") + public class RawTypes { + @Test + public void testAllFilesPresentInRawTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/rawTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("kt57620.kt") + public void testKt57620() throws Exception { + runTest("compiler/testData/diagnostics/tests/rawTypes/kt57620.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/reassignment") @TestDataPath("$PROJECT_ROOT") 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 72cdccf1f7e..45b5e488fea 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 @@ -25675,6 +25675,22 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated } } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/rawTypes") + @TestDataPath("$PROJECT_ROOT") + public class RawTypes { + @Test + public void testAllFilesPresentInRawTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/rawTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("kt57620.kt") + public void testKt57620() throws Exception { + runTest("compiler/testData/diagnostics/tests/rawTypes/kt57620.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/reassignment") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index e80b25c1124..33d9aa72a2f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -25675,6 +25675,22 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir } } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/rawTypes") + @TestDataPath("$PROJECT_ROOT") + public class RawTypes { + @Test + public void testAllFilesPresentInRawTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/rawTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("kt57620.kt") + public void testKt57620() throws Exception { + runTest("compiler/testData/diagnostics/tests/rawTypes/kt57620.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/reassignment") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index dc46fa0efb1..a056c73e438 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -25681,6 +25681,22 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia } } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/rawTypes") + @TestDataPath("$PROJECT_ROOT") + public class RawTypes { + @Test + public void testAllFilesPresentInRawTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/rawTypes"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); + } + + @Test + @TestMetadata("kt57620.kt") + public void testKt57620() throws Exception { + runTest("compiler/testData/diagnostics/tests/rawTypes/kt57620.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/reassignment") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt b/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt new file mode 100644 index 00000000000..8df4ecc0a5e --- /dev/null +++ b/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt @@ -0,0 +1,29 @@ +// !CHECK_TYPE +// FILE: PythonRunParams.java +import java.util.Map; + +public interface PythonRunParams { + Map fetchEnvs(); +} + +// FILE: AbstractPythonRunConfiguration.java +import java.util.HashMap; +import java.util.Map; + +public class AbstractPythonRunConfiguration implements PythonRunParams { + public Map fetchEnvs() { + return null; + } +} + + +// FILE: PythonRunConfiguration.java +public class PythonRunConfiguration extends AbstractPythonRunConfiguration implements PythonRunParams {} + +// FILE: ProjectMain.kt + +fun getRunCommandLine(configuration: PythonRunConfiguration) { + fun foo(envs: Map) {} + checkSubtype>(configuration.fetchEnvs()) + checkSubtype>(configuration.fetchEnvs()) +} diff --git a/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt b/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt new file mode 100644 index 00000000000..8613a018aeb --- /dev/null +++ b/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt @@ -0,0 +1,29 @@ +// !CHECK_TYPE +// FILE: PythonRunParams.java +import java.util.Map; + +public interface PythonRunParams { + Map fetchEnvs(); +} + +// FILE: AbstractPythonRunConfiguration.java +import java.util.HashMap; +import java.util.Map; + +public class AbstractPythonRunConfiguration implements PythonRunParams { + public Map fetchEnvs() { + return null; + } +} + + +// FILE: PythonRunConfiguration.java +public class PythonRunConfiguration extends AbstractPythonRunConfiguration implements PythonRunParams {} + +// FILE: ProjectMain.kt + +fun getRunCommandLine(configuration: PythonRunConfiguration) { + fun foo(envs: Map) {} + checkSubtype>(configuration.fetchEnvs()) + checkSubtype>(configuration.fetchEnvs()) +} 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 4e9324cf410..282ff11cf7a 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 @@ -26519,6 +26519,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } } + @Nested + @TestMetadata("compiler/testData/diagnostics/tests/rawTypes") + @TestDataPath("$PROJECT_ROOT") + public class RawTypes { + @Test + public void testAllFilesPresentInRawTypes() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/rawTypes"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("kt57620.kt") + public void testKt57620() throws Exception { + runTest("compiler/testData/diagnostics/tests/rawTypes/kt57620.kt"); + } + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/reassignment") @TestDataPath("$PROJECT_ROOT")