diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index 156fefb3fb4..73a236ad3c4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -930,26 +930,10 @@ public class JetParsing extends AbstractJetParsing { myBuilder.disableJoiningComplexTokens(); - // TODO: extract constant - int lastDot = matchTokenStreamPredicate(new LastBefore( - new AtSet(DOT, SAFE_ACCESS), - new AbstractTokenStreamPredicate() { - @Override - public boolean matching(boolean topLevel) { - if (topLevel && (at(EQ) || at(COLON))) return true; - if (topLevel && at(IDENTIFIER)) { - IElementType lookahead = lookahead(1); - return lookahead != LT && lookahead != DOT && lookahead != SAFE_ACCESS && lookahead != QUEST; - } - return false; - } - })); - PsiBuilder.Marker receiver = mark(); - parseReceiverType("property", propertyNameFollow, lastDot); + boolean receiverTypeDeclared = parseReceiverType("property", propertyNameFollow); boolean multiDeclaration = at(LPAR); - boolean receiverTypeDeclared = lastDot != -1; errorIf(receiver, multiDeclaration && receiverTypeDeclared, "Receiver type is not allowed on a multi-declaration"); @@ -1155,12 +1139,11 @@ public class JetParsing extends AbstractJetParsing { } myBuilder.disableJoiningComplexTokens(); - int lastDot = findLastBefore(RECEIVER_TYPE_TERMINATORS, TokenSet.create(LPAR), true); TokenSet functionNameFollow = TokenSet.create(LT, LPAR, COLON, EQ); - parseReceiverType("function", functionNameFollow, lastDot); + boolean receiverFound = parseReceiverType("function", functionNameFollow); - parseFunctionOrPropertyName(lastDot != -1, "function", functionNameFollow); + parseFunctionOrPropertyName(receiverFound, "function", functionNameFollow); myBuilder.restoreJoiningComplexTokensState(); @@ -1201,20 +1184,72 @@ public class JetParsing extends AbstractJetParsing { /* * (type "." | annotations)? */ - private void parseReceiverType(String title, TokenSet nameFollow, int lastDot) { - if (lastDot == -1) { // There's no explicit receiver type specified - parseAnnotations(REGULAR_ANNOTATIONS_ONLY_WITH_BRACKETS); - } - else { - createTruncatedBuilder(lastDot).parseTypeRef(); - - if (atSet(RECEIVER_TYPE_TERMINATORS)) { - advance(); // expectation + private boolean parseReceiverType(String title, TokenSet nameFollow) { + PsiBuilder.Marker annotations = mark(); + boolean annotationsPresent = parseAnnotations(REGULAR_ANNOTATIONS_ONLY_WITH_BRACKETS); + int lastDot = lastDotAfterReceiver(); + boolean receiverPresent = lastDot != -1; + if (annotationsPresent) { + if (receiverPresent) { + annotations.rollbackTo(); } else { - errorWithRecovery("Expecting '.' before a " + title + " name", nameFollow); + annotations.error("Annotations are not allowed in this position"); } } + else { + annotations.drop(); + } + + if (!receiverPresent) return false; + + createTruncatedBuilder(lastDot).parseTypeRef(); + + if (atSet(RECEIVER_TYPE_TERMINATORS)) { + advance(); // expectation + } + else { + errorWithRecovery("Expecting '.' before a " + title + " name", nameFollow); + } + return true; + } + + private int lastDotAfterReceiver() { + if (at(LPAR)) { + return matchTokenStreamPredicate( + new FirstBefore( + new AtSet(RECEIVER_TYPE_TERMINATORS), + new AbstractTokenStreamPredicate() { + @Override + public boolean matching(boolean topLevel) { + if (topLevel && definitelyOutOfReceiver()) { + return true; + } + return topLevel && !at(QUEST) && !at(LPAR) && !at(RPAR); + } + } + )); + } + else { + return matchTokenStreamPredicate( + new LastBefore( + new AtSet(RECEIVER_TYPE_TERMINATORS), + new AbstractTokenStreamPredicate() { + @Override + public boolean matching(boolean topLevel) { + if (topLevel && (definitelyOutOfReceiver() || at(LPAR))) return true; + if (topLevel && at(IDENTIFIER)) { + IElementType lookahead = lookahead(1); + return lookahead != LT && lookahead != DOT && lookahead != SAFE_ACCESS && lookahead != QUEST; + } + return false; + } + })); + } + } + + private boolean definitelyOutOfReceiver() { + return atSet(EQ, COLON, LBRACE, BY_KEYWORD) || atSet(TOPLEVEL_OBJECT_FIRST); } /* diff --git a/compiler/testData/psi/Functions.txt b/compiler/testData/psi/Functions.txt index 2c6d15df9f5..4d115b60e14 100644 --- a/compiler/testData/psi/Functions.txt +++ b/compiler/testData/psi/Functions.txt @@ -12,15 +12,16 @@ JetFile: Functions.kt FUN PsiElement(fun)('fun') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') VALUE_PARAMETER_LIST @@ -168,15 +169,16 @@ JetFile: Functions.kt FUN PsiElement(fun)('fun') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') VALUE_PARAMETER_LIST @@ -331,15 +333,16 @@ JetFile: Functions.kt FUN PsiElement(fun)('fun') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') VALUE_PARAMETER_LIST diff --git a/compiler/testData/psi/Properties.txt b/compiler/testData/psi/Properties.txt index 5aed763cd98..0bb193d2b07 100644 --- a/compiler/testData/psi/Properties.txt +++ b/compiler/testData/psi/Properties.txt @@ -27,15 +27,16 @@ JetFile: Properties.kt PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n') @@ -64,15 +65,16 @@ JetFile: Properties.kt PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/Properties_ERR.txt b/compiler/testData/psi/Properties_ERR.txt index d8c7c40f52c..cbe90e9e94d 100644 --- a/compiler/testData/psi/Properties_ERR.txt +++ b/compiler/testData/psi/Properties_ERR.txt @@ -43,23 +43,24 @@ JetFile: Properties_ERR.kt PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Expecting ']' to close an list of annotation - + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting ']' to close the annotation list + PsiWhiteSpace(' ') PsiElement(EQ)('=') PsiWhiteSpace(' ') @@ -84,15 +85,16 @@ JetFile: Properties_ERR.kt PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/TypeParametersBeforeName.txt b/compiler/testData/psi/TypeParametersBeforeName.txt index 7cf176a5cae..961f89f9fd8 100644 --- a/compiler/testData/psi/TypeParametersBeforeName.txt +++ b/compiler/testData/psi/TypeParametersBeforeName.txt @@ -32,15 +32,16 @@ JetFile: TypeParametersBeforeName.kt PsiElement(IDENTIFIER)('B') PsiElement(GT)('>') PsiWhiteSpace(' ') - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiErrorElement:Annotations are not allowed in this position + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') VALUE_PARAMETER_LIST diff --git a/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt b/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt index d56d01b4a0d..eb46913f1d1 100644 --- a/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt +++ b/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.kt @@ -1,12 +1,10 @@ -typealias f = {T.T.() : ()} -typealias f = {{(S).() : ()}.() : ()} -typealias f = {{T.() : ()}.() : ()} -typealias f = {{T.T.() : ()}.() : ()} -typealias f = {{T.T.() : ()}.() : ()} -typealias f = {{(S).() : ()}.() : ()} +typealias f = (((S).() -> S).() -> S) +typealias f = ((T.() -> S).() -> S) +typealias f = ((T.T.() -> S).() -> S) +typealias f = ((T.T.() -> S).() -> S) +typealias f = (((S).() -> S).() -> S) -typealias f = [a] {[a] {(S).() : ()}.() : ()} -typealias f = [a] {[a] {T.() : ()}.() : ()} -typealias f = [a] {[a] {T.T.() : ()}.() : ()} -typealias f = [a] {[a] {T.T.() : ()}.() : ()} -typealias f = [a] {[a] {(S).() : ()}.() : ()} \ No newline at end of file +typealias f = [a] ([a] ((S).() -> S).() -> S) +typealias f = [a] ([a] (T.() -> S).() -> S) +typealias f = [a] ([a] (T.() -> S).() -> S) +typealias f = [a] ([a] ((S).() -> S).() -> S) \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.txt index ddc59c7ef4b..e21a1b5a743 100644 --- a/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.txt @@ -9,118 +9,43 @@ JetFile: FunctionTypesWithFunctionReceivers.kt PsiElement(EQ)('=') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE + PsiElement(LPAR)('(') USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('S') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') TYPEDEF PsiElement(typealias)('typealias') @@ -130,248 +55,206 @@ JetFile: FunctionTypesWithFunctionReceivers.kt PsiElement(EQ)('=') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('S') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiElement(GT)('>') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') TYPEDEF PsiElement(typealias)('typealias') @@ -390,67 +273,54 @@ JetFile: FunctionTypesWithFunctionReceivers.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('S') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') TYPEDEF PsiElement(typealias)('typealias') @@ -469,244 +339,52 @@ JetFile: FunctionTypesWithFunctionReceivers.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(typealias)('typealias') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') TYPEDEF PsiElement(typealias)('typealias') @@ -725,64 +403,130 @@ JetFile: FunctionTypesWithFunctionReceivers.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('S') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') \ No newline at end of file + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('S') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt index 7060a6e3735..1a2aba704a4 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.kt @@ -1,12 +1,11 @@ -fun {[a] T.(A) : ()}.foo() -fun {[a] T.(A) : ()}.foo(); -fun {[a] T.(A) : ()}.foo() {} -fun [a] {[a] T.(A) : ()}.foo() {} -fun [a] {() : Unit}.foo() +fun ([a] T.(A) -> Unit).foo() +fun ([a] T.(A) -> C).foo(); +fun [a] ([a] T.(A) -> R).foo() {} +fun [a] ((B.(A ->B)) -> Unit).foo() +fun [a] ((A, B) -> Unit).foo() +fun ((T) -> G)?.foo() +fun ((T) -> G)??.foo() -// And tuples, too -fun (A, B).foo() : Unit {} - - -// Recovery -fun fun [a] T.(A) : ().-() +//-------------- +fun f() +a.b class C \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt index 242dd9f3e3c..fcc090b7909 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt @@ -5,251 +5,137 @@ JetFile: FunctionsWithFunctionReceivers.kt PsiElement(fun)('fun') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting '.' before a function name - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting function name - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting '(' - - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - 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)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - FUN - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting '.' before a function name - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting function name - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting '(' - - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - 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)('>') - PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(SEMICOLON)(';') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting '.' before a function name - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting function name - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting '(' - - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') + PsiElement(IDENTIFIER)('C') TYPE_ARGUMENT_LIST PsiElement(LT)('<') TYPE_PROJECTION TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') + PsiElement(IDENTIFIER)('D') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') TYPE_PROJECTION TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('E') PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') PsiElement(DOT)('.') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -264,88 +150,66 @@ JetFile: FunctionsWithFunctionReceivers.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('R') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiErrorElement:Expecting '.' before a function name + BLOCK PsiElement(LBRACE)('{') - PsiErrorElement:Expecting function name - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting '(' - - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - 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)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') @@ -370,27 +234,53 @@ JetFile: FunctionsWithFunctionReceivers.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Type expected - - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiErrorElement:Expecting comma or ')' + + PsiWhiteSpace(' ') + PsiErrorElement:Expecting ')' + PsiElement(ARROW)('->') + PsiErrorElement:Expecting '->' to specify return type of a function type + + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') PsiErrorElement:Expecting '.' before a function name - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting function name - - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Unit') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') + PsiErrorElement:Expecting function name + PsiElement(DOT)('.') + PsiErrorElement:Expecting '(' + FUN MODIFIER_LIST ANNOTATION_ENTRY @@ -402,129 +292,151 @@ JetFile: FunctionsWithFunctionReceivers.kt VALUE_ARGUMENT_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') - PsiWhiteSpace('\n\n') - PsiComment(EOL_COMMENT)('// And tuples, too') PsiWhiteSpace('\n') PsiElement(fun)('fun') - PsiErrorElement:Expecting function name or receiver type - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER PsiElement(IDENTIFIER)('A') - PsiErrorElement:Parameters must have type annotation - PsiElement(COMMA)(',') PsiWhiteSpace(' ') - VALUE_PARAMETER + TYPE_PARAMETER PsiElement(IDENTIFIER)('B') - PsiErrorElement:Parameters must have type annotation - - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + PsiElement(GT)('>') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Unit') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n\n') - PsiComment(EOL_COMMENT)('// Recovery') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') FUN PsiElement(fun)('fun') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Expecting '.' before a function name - PsiElement(fun)('fun') + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') PsiWhiteSpace(' ') - PsiErrorElement:Expecting function name - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting '(' - - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION + TYPE_REFERENCE + NULLABLE_TYPE + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(QUEST)('?') PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiErrorElement:Expecting a top level declaration - PsiElement(DOT)('.') - PsiErrorElement:Expecting a top level declaration - PsiElement(MINUS)('-') - PsiErrorElement:Expecting a top level declaration - PsiElement(LPAR)('(') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') \ No newline at end of file + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PsiComment(EOL_COMMENT)('//--------------') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('C') \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.kt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.kt new file mode 100644 index 00000000000..5275ef97d69 --- /dev/null +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.kt @@ -0,0 +1,5 @@ +fun ([a] T.(A) -> Unit).foo() +fun ([a] T.(A) -> C).foo(); +fun [a] ([a] T.(A) -> R).foo() {} +fun [a] (() -> Unit).foo() +[a] fun [a] ((A, B) -> Unit).foo() diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.txt new file mode 100644 index 00000000000..bb9f4a0549d --- /dev/null +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.txt @@ -0,0 +1,321 @@ +JetFile: FunctionsWithFunctionReceiversAnnotations.kt + PACKAGE_DIRECTIVE + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('D') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('E') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('R') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.kt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.kt new file mode 100644 index 00000000000..47c78e78ece --- /dev/null +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.kt @@ -0,0 +1,28 @@ +fun ((T) -> G).foo

{ } +fun ((T) -> G).foo { } +fun ((T) -> G).foo

+fun ((T) -> G).foo = 0 +fun ((T) -> G)?.foo { } +fun ((T) -> G)??.foo { } + +fun ([a] T.(A, C) -> ).foo() {} +fun fun [a] T.(A).foo() + +fun [a] (T.(A)).foo() +fun [a] ((A)-).foo() + +fun ((T)->G).foo +class C. + +fun foo {} +c. + +//----------- +class A { + fun foo() { + } +} + +fun bar(a: A) { + a.foo() +} \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt new file mode 100644 index 00000000000..639d7859661 --- /dev/null +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt @@ -0,0 +1,645 @@ +JetFile: FunctionsWithFunctionReceiversRecovery.kt + PACKAGE_DIRECTIVE + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('P') + PsiElement(GT)('>') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('P') + PsiElement(GT)('>') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('0') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('D') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('E') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting function name or receiver type + PsiElement(fun)('fun') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + 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)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(RPAR)(')') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(DOT)('.') + PsiErrorElement:Expecting comma or ')' + + PsiErrorElement:Expecting ')' + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(LPAR)('(') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting '.' before a function name + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting function name + PsiElement(LBRACKET)('[') + PsiErrorElement:Expecting '(' + + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiErrorElement:Expecting a top level declaration + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(MINUS)('-') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiElement(ARROW)('->') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace('\n') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('C') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('c') + PsiElement(GT)('>') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('c') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('t') + PsiElement(GT)('>') + PsiElement(DOT)('.') + PsiWhiteSpace('\n\n') + PsiComment(EOL_COMMENT)('//-----------') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting type name + PsiElement(class)('class') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('X') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('Y') + PsiElement(GT)('>') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt index 10bc73447c1..ecdd563a581 100644 --- a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt @@ -1,34 +1,34 @@ -val {() : ()}.foo -val {foo.bar.() : ()}.foo +val ((Unit) -> Unit).foo +val (foo.bar.() -> Unit).foo -val {foo.bar.() : ()}.foo = foo +val (foo.bar.() -> Unit).foo = foo get() {} set(it) {} -val {foo.bar.() : ()}.foo = foo +val (foo.bar.() -> Unit).foo = foo get() : Foo {} set(it) {} -val {foo.bar.() : ()}.foo : bar = foo +val (foo.bar.() -> Unit).foo : bar = foo [a] public get() {} open set(a : b) {} -val {foo.bar.() : ()}.foo : bar = foo +val (foo.bar.() -> Unit).foo : bar = foo open set(a : b) {} -val {foo.bar.() : ()}.foo : bar = foo +val (foo.bar.() -> Unit).foo : bar = foo [a] public get() {} // Error recovery: -val {foo.bar.() : ()}.foo = foo +val (foo.bar.() -> Unit).foo = foo set) {} dfget() {} -val {foo.bar.() : ()}.foo = foo +val (foo.bar.() -> Unit).foo = foo get(foo) {} set() {} set() {} diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt index 528ad74fbad..c86632d926e 100644 --- a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt @@ -5,387 +5,389 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n') PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n\n') PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(get)('get') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(set)('set') + PsiElement(LPAR)('(') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('it') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(get)('get') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(COLON)(':') PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('get') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT + TYPE_REFERENCE + USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('it') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(set)('set') + PsiElement(LPAR)('(') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('it') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n\n') PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('get') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('it') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n\n') - PROPERTY - PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(get)('get') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(open)('open') PsiWhiteSpace(' ') + PsiElement(set)('set') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(public)('public') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('get') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - MODIFIER_LIST - PsiElement(open)('open') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n\n') PROPERTY PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - PsiElement(open)('open') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - BINARY_WITH_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n\n') - PROPERTY - PsiElement(val)('val') + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(open)('open') + PsiWhiteSpace(' ') + PsiElement(set)('set') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n\n') + PROPERTY + PsiElement(val)('val') PsiWhiteSpace(' ') - PsiElement(public)('public') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('get') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n') PsiComment(EOL_COMMENT)('// Error recovery:') PsiWhiteSpace('\n\n') @@ -393,43 +395,53 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - PsiErrorElement:Expecting a top level declaration - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(set)('set') + PsiErrorElement:Accessor body expected + PsiElement(RPAR)(')') + PsiErrorElement:Expecting '(' + + PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiErrorElement:Expecting parameter name + + PsiErrorElement:Expecting ')' + + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') MODIFIER_LIST ANNOTATION_ENTRY @@ -451,63 +463,60 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE - PsiErrorElement:Type expected - - PsiErrorElement:Property getter or setter expected - PsiElement(LBRACE)('{') - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RBRACE)('}') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('get') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiErrorElement:Expecting a top level declaration - PsiElement(LBRACE)('{') - PsiErrorElement:Expecting a top level declaration - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(get)('get') + PsiElement(LPAR)('(') + PsiErrorElement:Expecting ')' + PsiElement(IDENTIFIER)('foo') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + PsiElement(set)('set') + PsiElement(LPAR)('(') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiErrorElement:Expecting parameter name + + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') MODIFIER_LIST ANNOTATION_ENTRY diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.kt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.kt new file mode 100644 index 00000000000..ab23ad3988b --- /dev/null +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.kt @@ -0,0 +1,5 @@ +val ([a] T.(A) -> Unit).foo: P +val ([a] T.(A) -> C).foo: P +val [a] ([a] T.(A) -> R).foo: P +val [a] (() -> Unit).foo: P +[a] val [a] ((A, B) -> Unit).foo: P diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.txt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.txt new file mode 100644 index 00000000000..b2ba007a0f9 --- /dev/null +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.txt @@ -0,0 +1,331 @@ +JetFile: PropertiesWithFunctionReceiversAnnotations.kt + PACKAGE_DIRECTIVE + + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('P') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('D') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('E') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('P') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('R') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('P') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('P') + PsiWhiteSpace('\n') + PROPERTY + MODIFIER_LIST + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('P') \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.kt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.kt new file mode 100644 index 00000000000..bfecfff0ca9 --- /dev/null +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.kt @@ -0,0 +1,14 @@ +val ((T) -> G).foo

{ } +val ((T) -> G).foo get{ } +val ((T) -> G).foo

+val ((T) -> G).foo: = 0 +val ((T) -> G)?.foo +val ((T) -> G)??.foo + +val (T.(A, C) -> ).foo {} +val val [a] T.(A).foo() + +val [a] (T.(A)).foo() +val [a] ((A)-).foo() + +val c by A.B \ No newline at end of file diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.txt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.txt new file mode 100644 index 00000000000..b43625cbd3f --- /dev/null +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.txt @@ -0,0 +1,424 @@ +JetFile: PropertiesWithFunctionReceiversRecovery.kt + PACKAGE_DIRECTIVE + + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Property getter or setter expected + PsiElement(LT)('<') + PsiElement(IDENTIFIER)('P') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PROPERTY_ACCESSOR + PsiElement(get)('get') + PsiErrorElement:Accessor body expected + + PsiErrorElement:Expecting '(' + + PsiErrorElement:Expecting ')' + + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Property getter or setter expected + PsiElement(LT)('<') + PsiElement(IDENTIFIER)('P') + PsiElement(GT)('>') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('0') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + NULLABLE_TYPE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('G') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('D') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('E') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiErrorElement:Type expected + + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Property getter or setter expected + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiErrorElement:Expecting property name or receiver type + + PsiWhiteSpace(' ') + PsiErrorElement:Property getter or setter expected + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(LBRACKET)('[') + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('T') + PsiElement(LT)('<') + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiElement(DOT)('.') + PsiElement(LPAR)('(') + PsiElement(IDENTIFIER)('A') + PsiElement(LT)('<') + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('foo') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + 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)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(RPAR)(')') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(DOT)('.') + PsiErrorElement:Expecting comma or ')' + + PsiErrorElement:Expecting ')' + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(LPAR)('(') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(RPAR)(')') + PsiErrorElement:Expecting '.' before a property name + + PsiWhiteSpace('\n') + MULTI_VARIABLE_DECLARATION + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiErrorElement:Receiver type is not allowed on a multi-declaration + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + PsiElement(LPAR)('(') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiErrorElement:Expecting comma or ')' + + PsiErrorElement:Expecting ')' + PsiElement(MINUS)('-') + PsiErrorElement:Expecting '->' to specify return type of a function type + PsiElement(RPAR)(')') + TYPE_REFERENCE + PsiErrorElement:Type expected + PsiElement(DOT)('.') + PsiErrorElement:Expecting '.' before a property name + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Multi-declarations are only allowed for local variables/values + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a name + + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiErrorElement:Property getter or setter expected + PsiElement(LT)('<') + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(by)('by') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('B') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java index b4107748da5..74e3f6fba68 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java @@ -905,11 +905,35 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } + @TestMetadata("FunctionsWithFunctionReceiversAnnotations.kt") + public void testFunctionsWithFunctionReceiversAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversAnnotations.kt"); + doParsingTest(fileName); + } + + @TestMetadata("FunctionsWithFunctionReceiversRecovery.kt") + public void testFunctionsWithFunctionReceiversRecovery() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.kt"); + doParsingTest(fileName); + } + @TestMetadata("PropertiesWithFunctionReceivers.kt") public void testPropertiesWithFunctionReceivers() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.kt"); doParsingTest(fileName); } + + @TestMetadata("PropertiesWithFunctionReceiversAnnotations.kt") + public void testPropertiesWithFunctionReceiversAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversAnnotations.kt"); + doParsingTest(fileName); + } + + @TestMetadata("PropertiesWithFunctionReceiversRecovery.kt") + public void testPropertiesWithFunctionReceiversRecovery() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceiversRecovery.kt"); + doParsingTest(fileName); + } } @TestMetadata("compiler/testData/psi/greatSyntacticShift")