[FIR] KT-53988: Report ILLEGAL_SELECTOR for constants as selectors

Merge-request: KT-MR-7756
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>

^KT-53988 Fixed
This commit is contained in:
Nikolay Lunyak
2022-11-22 10:54:09 +00:00
committed by Space Team
parent f627d81d53
commit c5469d5fb5
12 changed files with 41 additions and 39 deletions
@@ -447,6 +447,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/kt53.kt");
}
@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 {
@@ -447,6 +447,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/kt53.kt");
}
@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 {
@@ -447,6 +447,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/kt53.kt");
}
@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 {
@@ -227,7 +227,6 @@ open class RawFirBuilder(
val callExpressionCallee = (this as? KtCallExpression)?.calleeExpression?.unwrapParenthesesLabelsAndAnnotations()
if (this is KtNameReferenceExpression ||
this is KtConstantExpression ||
(this is KtCallExpression && callExpressionCallee !is KtLambdaExpression) ||
getQualifiedExpressionForSelector() == null
) {
+6
View File
@@ -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()
}
+6
View File
@@ -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()<!>
}
+3
View File
@@ -0,0 +1,3 @@
package
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
@@ -447,6 +447,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/kt53.kt");
}
@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 {
@@ -1,19 +0,0 @@
// TESTCASE NUMBER: 1
val value_1 = 0./**/99901
// TESTCASE NUMBER: 2
val value_2 = 2./** some doc */1
// TESTCASE NUMBER: 3
val value_3 = 9999./** some doc *//**/1
// TESTCASE NUMBER: 4
val value_4 = 9999./** some /** some doc */ doc */1
// TESTCASE NUMBER: 5
val value_5 = 9999./**/
1
// TESTCASE NUMBER: 6
val value_6 = 1000000.//0
0
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
@@ -1,19 +0,0 @@
// TESTCASE NUMBER: 1
val value_1 = 0./**/99901f
// TESTCASE NUMBER: 2
val value_2 = 2./** some doc */1F
// TESTCASE NUMBER: 3
val value_3 = 9999./** some doc *//**/1f
// TESTCASE NUMBER: 4
val value_4 = 9999./** some /** some doc */ doc */1f
// TESTCASE NUMBER: 5
val value_5 = 9999./**/
1F
// TESTCASE NUMBER: 6
val value_6 = 1000000.//0
0F
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*