From 8712772a5f74e0fe51ff23ab99be53278f240b7e Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 1 Feb 2021 14:31:19 +0300 Subject: [PATCH] FIR: Add test for type resolution when referenced nested class from supertypes --- ...irOldFrontendDiagnosticsTestGenerated.java | 6 +++++ .../resolve/sameNameClassesFromSupertypes.kt | 22 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 +++++ 3 files changed, 34 insertions(+) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt 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 eab2c46ec0e..ee633872c72 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 @@ -34746,6 +34746,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti public void testSamOverloadsWithKtFunctionWithoutRefinedSams() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.kt"); } + + @Test + @TestMetadata("sameNameClassesFromSupertypes.kt") + public void testSameNameClassesFromSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt"); + } } @Nested diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt new file mode 100644 index 00000000000..3874d549007 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt @@ -0,0 +1,22 @@ +// FIR_IDENTICAL +// SKIP_TXT + +abstract class MostBase { + inner class Inner( + val bad: String, + ) +} + +abstract class Base : MostBase() { + inner class Inner( + val name: String?, + val res: Int, + ) +} + +class A : Base() { + fun foo(l: List) { + val m = l.groupBy(Inner::name) + m[""]!![0].res + } +} 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 369b623008a..cff81485a8c 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 @@ -34842,6 +34842,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { public void testSamOverloadsWithKtFunctionWithoutRefinedSams() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.kt"); } + + @Test + @TestMetadata("sameNameClassesFromSupertypes.kt") + public void testSameNameClassesFromSupertypes() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt"); + } } @Nested