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 767dbca090b..042fed4b060 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 @@ -4859,6 +4859,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt"); } + @Test + @TestMetadata("reservedExpressionSyntax4.kt") + public void testReservedExpressionSyntax4() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt"); + } + @Test @TestMetadata("syntheticExtensionOnLHS.kt") public void testSyntheticExtensionOnLHS() 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 07856da1f65..420f52ea5a6 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 @@ -4859,6 +4859,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt"); } + @Test + @TestMetadata("reservedExpressionSyntax4.kt") + public void testReservedExpressionSyntax4() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt"); + } + @Test @TestMetadata("syntheticExtensionOnLHS.kt") public void testSyntheticExtensionOnLHS() 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 5831a2c7655..a4a6d101f0c 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 @@ -4853,6 +4853,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt"); } + @Test + @TestMetadata("reservedExpressionSyntax4.kt") + public void testReservedExpressionSyntax4() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt"); + } + @Test @TestMetadata("syntheticExtensionOnLHS.kt") public void testSyntheticExtensionOnLHS() 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 c25ba88fe35..0c1de20d07f 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 @@ -4859,6 +4859,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt"); } + @Test + @TestMetadata("reservedExpressionSyntax4.kt") + public void testReservedExpressionSyntax4() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt"); + } + @Test @TestMetadata("syntheticExtensionOnLHS.kt") public void testSyntheticExtensionOnLHS() throws Exception { diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.fir.kt new file mode 100644 index 00000000000..5b64d457640 --- /dev/null +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.fir.kt @@ -0,0 +1,74 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// WITH_STDLIB + +class A { + class B { + class C { + fun foo() {} + } + + inner class InnerC { + fun foo() {} + } + + class ParametricC { + fun foo() {} + } + } +} + +fun goodClassifiers() { + A.B.C::class + A.B.C::foo + + A.B.InnerC::class + A.B.InnerC::foo +} + +fun nullableClassifiers() { + A.B.C?::class + A.B.C?::foo + + A.B.InnerC?::class + A.B.InnerC?::foo +} + +fun classifiersWithTA() { + A.B.C::class + A.B.C::foo + + A.B.InnerC::class + // A.B.InnerC::foo // correct + + A.B.ParametricC::class + A.B.ParametricC::foo +} + +val a get() = listOf(10) +val List.b get() = first() +val List.maybeB get() = firstOrNull() +val Int.c get() = A.B.C() +val Int.maybeC: A.B.C? get() = A.B.C() + +fun rain() { + a.b.c::class + a.b.c::foo + + a.b.c?::class + a.b.c?::foo + + a.b?.c::class + a.b?.c::foo + + a.maybeB?.c::class + a.maybeB?.c::foo + + a.b.c::class + a.b.c::foo + + a.b.maybeC::class + a.b.maybeC::foo + + a.b.maybeC?::class + a.b.maybeC?::foo +} diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt new file mode 100644 index 00000000000..d4441e84d4e --- /dev/null +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt @@ -0,0 +1,74 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// WITH_STDLIB + +class A { + class B { + class C { + fun foo() {} + } + + inner class InnerC { + fun foo() {} + } + + class ParametricC { + fun foo() {} + } + } +} + +fun goodClassifiers() { + A.B.C::class + A.B.C::foo + + A.B.InnerC::class + A.B.InnerC::foo +} + +fun nullableClassifiers() { + A.B.C?::class + A.B.C?::foo + + A.B.InnerC?::class + A.B.InnerC?::foo +} + +fun classifiersWithTA() { + A.B.C::class + A.B.C::foo + + A.B.InnerC::class + // A.B.InnerC::foo // correct + + A.B.ParametricC::class + A.B.ParametricC::foo +} + +val a get() = listOf(10) +val List.b get() = first() +val List.maybeB get() = firstOrNull() +val Int.c get() = A.B.C() +val Int.maybeC: A.B.C? get() = A.B.C() + +fun rain() { + a.b.c::class + a.b.c::foo + + a.b.c?::class + a.b.c?::foo + + a.b?.c::class + a.b?.c::foo + + a.maybeB?.c::class + a.maybeB?.c::foo + + a.b<Int>.c::class + a.b<Int>.c::foo + + a.b.maybeC::class + a.b.maybeC::foo + + a.b.maybeC?::class + a.b.maybeC?::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 f6b373109f5..99b09aa0300 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 @@ -4859,6 +4859,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt"); } + @Test + @TestMetadata("reservedExpressionSyntax4.kt") + public void testReservedExpressionSyntax4() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt"); + } + @Test @TestMetadata("syntheticExtensionOnLHS.kt") public void testSyntheticExtensionOnLHS() throws Exception {