[FIR] KT-53987: Report ILLEGAL_SELECTOR for constants as selectors
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
index 7064e43..a25ec0d 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
@@ -448,6 +448,12 @@
}
@Test
+ @TestMetadata("kt53988.kt")
+ public void testKt53988() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/kt53988.kt");
+ }
+
+ @Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
runTest("compiler/testData/diagnostics/tests/LValueAssignment.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 4d23ae0..b14d51c2 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
@@ -448,6 +448,12 @@
}
@Test
+ @TestMetadata("kt53988.kt")
+ public void testKt53988() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/kt53988.kt");
+ }
+
+ @Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
runTest("compiler/testData/diagnostics/tests/LValueAssignment.kt");
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
index 4711f1f..c55516b 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
@@ -448,6 +448,12 @@
}
@Test
+ @TestMetadata("kt53988.kt")
+ public void testKt53988() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/kt53988.kt");
+ }
+
+ @Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
runTest("compiler/testData/diagnostics/tests/LValueAssignment.kt");
diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt
index fb7578d..853304a 100644
--- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt
+++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt
@@ -227,7 +227,6 @@
val callExpressionCallee = (this as? KtCallExpression)?.calleeExpression?.unwrapParenthesesLabelsAndAnnotations()
if (this is KtNameReferenceExpression ||
- this is KtConstantExpression ||
(this is KtCallExpression && callExpressionCallee !is KtLambdaExpression) ||
getQualifiedExpressionForSelector() == null
) {
diff --git a/compiler/testData/diagnostics/tests/kt53988.fir.kt b/compiler/testData/diagnostics/tests/kt53988.fir.kt
new file mode 100644
index 0000000..b5a6e2b
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/kt53988.fir.kt
@@ -0,0 +1,6 @@
+fun main(args: Array<String>) {
+ return
+ .
+ <!ILLEGAL_SELECTOR, UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH!>1u<!> // The expression cannot be a selector (occur after a dot)
+ throw AssertionError()
+}
diff --git a/compiler/testData/diagnostics/tests/kt53988.kt b/compiler/testData/diagnostics/tests/kt53988.kt
new file mode 100644
index 0000000..6edca04
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/kt53988.kt
@@ -0,0 +1,6 @@
+fun main(args: Array<String>) {
+ return
+ <!UNREACHABLE_CODE!>.
+ <!ILLEGAL_SELECTOR, UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH!>1u<!><!> // The expression cannot be a selector (occur after a dot)
+ <!UNREACHABLE_CODE!>throw AssertionError()<!>
+}
diff --git a/compiler/testData/diagnostics/tests/kt53988.txt b/compiler/testData/diagnostics/tests/kt53988.txt
new file mode 100644
index 0000000..49ba831
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/kt53988.txt
@@ -0,0 +1,3 @@
+package
+
+public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
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 ada24f06..6b7fa71 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
@@ -448,6 +448,12 @@
}
@Test
+ @TestMetadata("kt53988.kt")
+ public void testKt53988() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/kt53988.kt");
+ }
+
+ @Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
runTest("compiler/testData/diagnostics/tests/LValueAssignment.kt");