KT-7377 Throwable: Empty PSI elements should not be passed to createDescriptor from UnusedReceiverParameterInspection
#KT-7377 fixed
This commit is contained in:
@@ -1366,7 +1366,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
private boolean definitelyOutOfReceiver() {
|
||||
return atSet(EQ, COLON, LBRACE, BY_KEYWORD) || atSet(TOPLEVEL_OBJECT_FIRST);
|
||||
return atSet(EQ, COLON, LBRACE, RBRACE, BY_KEYWORD) || atSet(TOPLEVEL_OBJECT_FIRST);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Clazz {
|
||||
val
|
||||
}
|
||||
|
||||
fun f() {
|
||||
a.b()
|
||||
}
|
||||
|
||||
class Clazz {
|
||||
val
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
JetFile: BareVal.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Clazz')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiErrorElement:Expecting property name or receiver type
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Clazz')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiErrorElement:Expecting property name or receiver type
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -1428,6 +1428,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/recovery"), Pattern.compile("^(.*)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("BareVal.kt")
|
||||
public void testBareVal() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/BareVal.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("DoWhileWithEmptyCondition.kt")
|
||||
public void testDoWhileWithEmptyCondition() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/recovery/DoWhileWithEmptyCondition.kt");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Clazz(foo: String) {
|
||||
val foo = foo
|
||||
|
||||
val
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
}
|
||||
Reference in New Issue
Block a user