Extend recovery set when expecting property accessor
#KT-12987 Fixed
This commit is contained in:
@@ -1279,7 +1279,9 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
|
||||
if (!atSet(EOL_OR_SEMICOLON, RBRACE)) {
|
||||
if (getLastToken() != SEMICOLON) {
|
||||
errorUntil("Property getter or setter expected", TokenSet.create(EOL_OR_SEMICOLON, LBRACE, RBRACE));
|
||||
errorUntil(
|
||||
"Property getter or setter expected",
|
||||
TokenSet.orSet(DECLARATION_FIRST, TokenSet.create(EOL_OR_SEMICOLON, LBRACE, RBRACE)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+2
@@ -10,4 +10,6 @@ abstract class A {
|
||||
private val<!SYNTAX!><!>
|
||||
fun foo3() {
|
||||
}
|
||||
|
||||
private val private<!SYNTAX!><!> fun foo() {}
|
||||
}
|
||||
|
||||
+2
@@ -5,7 +5,9 @@ public abstract class A {
|
||||
private final val <no name provided>: [ERROR : No type, no body]
|
||||
private final val <no name provided>: [ERROR : No type, no body]
|
||||
private final val <no name provided>: [ERROR : No type, no body]
|
||||
private final val private: [ERROR : No type, no body]
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
private final fun foo1(): kotlin.Unit
|
||||
protected abstract fun foo2(): kotlin.Unit
|
||||
public final fun foo3(): kotlin.Unit
|
||||
|
||||
+7
-6
@@ -293,14 +293,15 @@ JetFile: DefaultKeyword.kt
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('companion')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(object)('object')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
<empty list>
|
||||
BLOCK
|
||||
PsiWhiteSpace(' ')
|
||||
OBJECT_DECLARATION
|
||||
PsiElement(object)('object')
|
||||
PsiErrorElement:Name expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
|
||||
+19
-10
@@ -384,10 +384,13 @@ JetFile: FunctionExpressions_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -400,10 +403,13 @@ JetFile: FunctionExpressions_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('open')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -416,10 +422,13 @@ JetFile: FunctionExpressions_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('final')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n\n')
|
||||
@@ -647,4 +656,4 @@ JetFile: FunctionExpressions_ERR.kt
|
||||
PsiElement(IDENTIFIER)('V')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+12
-6
@@ -7,10 +7,16 @@ JetFile: TypealiasIsKeyword.kt
|
||||
PsiElement(val)('val')
|
||||
PsiErrorElement:Expecting property name or receiver type
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(INTEGER_LITERAL)('0')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
TYPEALIAS
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiErrorElement:Type name expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
PsiElement(INTEGER_LITERAL)('0')
|
||||
+33
-13
@@ -278,21 +278,41 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
|
||||
PsiElement(val)('val')
|
||||
PsiErrorElement:Expecting property name or receiver type
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(LT)('<')
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
DESTRUCTURING_DECLARATION
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
|
||||
TYPE_REFERENCE
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(LT)('<')
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiErrorElement:Expecting ')'
|
||||
PsiElement(LT)('<')
|
||||
PsiErrorElement:Property getter or setter expected
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -433,4 +453,4 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(DOT)('.')
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
Reference in New Issue
Block a user