From 99234ef1c5d1f6070abc07372818ab63b0b010bc Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 22 Nov 2023 15:34:58 +0100 Subject: [PATCH] K2: reproduce KT-63377 (+ consider some more cases) --- ...CompilerTestFE10TestdataTestGenerated.java | 6 +++ ...sticCompilerFE10TestDataTestGenerated.java | 6 +++ ...eeOldFrontendDiagnosticsTestGenerated.java | 6 +++ ...siOldFrontendDiagnosticsTestGenerated.java | 6 +++ .../memberTypeParameterVsNestedClass.fir.kt | 21 +++++++++++ .../memberTypeParameterVsNestedClass.fir.txt | 37 +++++++++++++++++++ .../memberTypeParameterVsNestedClass.kt | 21 +++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 +++ 8 files changed, 109 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.kt create mode 100644 compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.txt create mode 100644 compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.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 45d18e320e9..98b9946b7bd 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 @@ -37476,6 +37476,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass.kt") + public void testMemberTypeParameterVsNestedClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { 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 74c27b7fe2c..f07ab0a146d 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 @@ -37476,6 +37476,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass.kt") + public void testMemberTypeParameterVsNestedClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { 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 66eeb0db4d5..527cfb32149 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 @@ -35350,6 +35350,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass.kt") + public void testMemberTypeParameterVsNestedClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { 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 8a38271c0f6..24cc88636ee 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 @@ -35470,6 +35470,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass.kt") + public void testMemberTypeParameterVsNestedClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception { diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.kt new file mode 100644 index 00000000000..b1c6c0e15f7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.kt @@ -0,0 +1,21 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class OuterClass { + class OuterParam + + fun foo(t: NestedParam) { + val k: OuterParam = t + val l: OuterParam = OuterParam() + } + + inner class Inner(t: NestedParam) { + val k: OuterParam = t + val l: OuterParam = OuterParam() + + init { + val m: OuterParam = t + val n: OuterParam = OuterParam() + } + } +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.txt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.txt new file mode 100644 index 00000000000..b574f0a515d --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.fir.txt @@ -0,0 +1,37 @@ +FILE: memberTypeParameterVsNestedClass.fir.kt + public final class OuterClass : R|kotlin/Any| { + public constructor(): R|OuterClass| { + super() + } + + public final class OuterParam : R|kotlin/Any| { + public constructor(): R|OuterClass.OuterParam| { + super() + } + + } + + public final fun foo(t: R|NestedParam|): R|kotlin/Unit| { + lval k: R|OuterClass.OuterParam| = R|/t| + lval l: R|OuterClass.OuterParam| = R|/OuterClass.OuterParam.OuterParam|() + } + + public final inner class Inner : R|kotlin/Any| { + public OuterClass.constructor(t: R|NestedParam|): R|OuterClass.Inner| { + super() + } + + public final val k: R|OuterParam| = R|/t| + public get(): R|OuterParam| + + public final val l: R|OuterParam| = R|/OuterClass.OuterParam.OuterParam#|() + public get(): R|OuterParam| + + init { + lval m: R|OuterClass.OuterParam| = R|/t| + lval n: R|OuterClass.OuterParam| = R|/OuterClass.OuterParam.OuterParam|() + } + + } + + } diff --git a/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt new file mode 100644 index 00000000000..77e6e931962 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt @@ -0,0 +1,21 @@ +// ISSUE: KT-63377 +// FIR_DUMP + +class OuterClass { + class OuterParam + + fun foo(t: NestedParam) { + val k: OuterParam = t + val l: OuterParam = OuterParam() + } + + inner class Inner(t: NestedParam) { + val k: OuterParam = t + val l: OuterParam = OuterParam() + + init { + val m: OuterParam = t + val n: OuterParam = OuterParam() + } + } +} 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 7c6e46ba920..5b43f84a2cb 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 @@ -37476,6 +37476,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt"); } + @Test + @TestMetadata("memberTypeParameterVsNestedClass.kt") + public void testMemberTypeParameterVsNestedClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt"); + } + @Test @TestMetadata("misplacedConstraints.kt") public void testMisplacedConstraints() throws Exception {