Fix AE: No receiver found on incomplete code with $-signs
^KT-24158 Fixed
This commit is contained in:
+16
@@ -9106,6 +9106,22 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/exceptions")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Exceptions extends AbstractFirDiagnosticTest {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExceptions() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt24158.kt")
|
||||||
|
public void testKt24158() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/exceptions/kt24158.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -459,17 +459,13 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
if (!firstExpressionParsed) {
|
if (!firstExpressionParsed) {
|
||||||
expression.drop();
|
expression.drop();
|
||||||
expression = mark();
|
expression = mark();
|
||||||
|
firstExpressionParsed = parseAtomicExpression();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseSelectorCallExpression();
|
parseSelectorCallExpression();
|
||||||
|
|
||||||
if (firstExpressionParsed) {
|
expression.done(expressionType);
|
||||||
expression.done(expressionType);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
firstExpressionParsed = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (atSet(Precedence.POSTFIX.getOperations())) {
|
else if (atSet(Precedence.POSTFIX.getOperations())) {
|
||||||
parseOperationReference();
|
parseOperationReference();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ interface KtQualifiedExpression : KtExpression {
|
|||||||
val operationSign: KtSingleValueToken
|
val operationSign: KtSingleValueToken
|
||||||
get() = operationTokenNode.elementType as KtSingleValueToken
|
get() = operationTokenNode.elementType as KtSingleValueToken
|
||||||
|
|
||||||
private fun KtQualifiedExpression.getExpression(afterOperation: Boolean): KtExpression? {
|
private fun getExpression(afterOperation: Boolean): KtExpression? {
|
||||||
return operationTokenNode.psi?.siblings(afterOperation, false)?.firstIsInstanceOrNull<KtExpression>()
|
return operationTokenNode.psi?.siblings(afterOperation, false)?.firstIsInstanceOrNull<KtExpression>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
null + <!SYNTAX!>$foo<!>.<!SYNTAX!>$bar<!>.<!SYNTAX!><!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo2() {
|
||||||
|
null + <!SYNTAX!>$foo<!>. <!SYNTAX!>$bar<!> . <!SYNTAX!>$baz<!> .<!SYNTAX!><!>
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fun main() {
|
||||||
|
null + $foo.$bar.
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo2() {
|
||||||
|
null + $foo. $bar . $baz .
|
||||||
|
}
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
KtFile: kt24158.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('main')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
NULL
|
||||||
|
PsiElement(null)('null')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
PsiElement(FIELD_IDENTIFIER)('$foo')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
PsiElement(FIELD_IDENTIFIER)('$bar')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo2')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
NULL
|
||||||
|
PsiElement(null)('null')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(PLUS)('+')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
PsiElement(FIELD_IDENTIFIER)('$foo')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
PsiElement(FIELD_IDENTIFIER)('$bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
PsiElement(FIELD_IDENTIFIER)('$baz')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting an element
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
Generated
+16
@@ -9112,6 +9112,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/exceptions")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Exceptions extends AbstractDiagnosticTest {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExceptions() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exceptions"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt24158.kt")
|
||||||
|
public void testKt24158() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/exceptions/kt24158.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -2273,6 +2273,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
runTest("compiler/testData/psi/recovery/kt2172.kt");
|
runTest("compiler/testData/psi/recovery/kt2172.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt24158.kt")
|
||||||
|
public void testKt24158() throws Exception {
|
||||||
|
runTest("compiler/testData/psi/recovery/kt24158.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5102.kt")
|
@TestMetadata("kt5102.kt")
|
||||||
public void testKt5102() throws Exception {
|
public void testKt5102() throws Exception {
|
||||||
runTest("compiler/testData/psi/recovery/kt5102.kt");
|
runTest("compiler/testData/psi/recovery/kt5102.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user