Implement parsing of desctructuring declarations in lambdas
#KT-5828 In Progress
This commit is contained in:
@@ -45,6 +45,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
|
|
||||||
private static final IElementType[] LOCAL_DECLARATION_FIRST =
|
private static final IElementType[] LOCAL_DECLARATION_FIRST =
|
||||||
new IElementType[] {CLASS_KEYWORD, INTERFACE_KEYWORD, FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, TYPE_ALIAS_KEYWORD};
|
new IElementType[] {CLASS_KEYWORD, INTERFACE_KEYWORD, FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, TYPE_ALIAS_KEYWORD};
|
||||||
|
private static final TokenSet TOKEN_SET_TO_FOLLOW_AFTER_DESTRUCTURING_DECLARATION_IN_LAMBDA = TokenSet.create(ARROW, COMMA, COLON);
|
||||||
|
|
||||||
private static ImmutableMap<String, KtToken> tokenSetToMap(TokenSet tokens) {
|
private static ImmutableMap<String, KtToken> tokenSetToMap(TokenSet tokens) {
|
||||||
ImmutableMap.Builder<String, KtToken> builder = ImmutableMap.builder();
|
ImmutableMap.Builder<String, KtToken> builder = ImmutableMap.builder();
|
||||||
@@ -1054,10 +1055,11 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
advance(); // ARROW
|
advance(); // ARROW
|
||||||
paramsFound = true;
|
paramsFound = true;
|
||||||
}
|
}
|
||||||
else if (at(IDENTIFIER) || at(COLON)) {
|
else if (at(IDENTIFIER) || at(COLON) || at(LPAR)) {
|
||||||
// Try to parse a simple name list followed by an ARROW
|
// Try to parse a simple name list followed by an ARROW
|
||||||
// {a -> ...}
|
// {a -> ...}
|
||||||
// {a, b -> ...}
|
// {a, b -> ...}
|
||||||
|
// {(a, b) -> ... }
|
||||||
PsiBuilder.Marker rollbackMarker = mark();
|
PsiBuilder.Marker rollbackMarker = mark();
|
||||||
IElementType nextToken = lookahead(1);
|
IElementType nextToken = lookahead(1);
|
||||||
boolean preferParamsToExpressions = (nextToken == COMMA || nextToken == COLON);
|
boolean preferParamsToExpressions = (nextToken == COMMA || nextToken == COLON);
|
||||||
@@ -1144,7 +1146,11 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (SimpleName (":" type)?){","}
|
* lambdaParameter{","}
|
||||||
|
*
|
||||||
|
* lambdaParameter
|
||||||
|
* : variableDeclarationEntry
|
||||||
|
* : multipleVariableDeclarations (":" type)?
|
||||||
*/
|
*/
|
||||||
private void parseFunctionLiteralParameterList() {
|
private void parseFunctionLiteralParameterList() {
|
||||||
PsiBuilder.Marker parameterList = mark();
|
PsiBuilder.Marker parameterList = mark();
|
||||||
@@ -1155,6 +1161,11 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
if (at(COLON)) {
|
if (at(COLON)) {
|
||||||
error("Expecting parameter name");
|
error("Expecting parameter name");
|
||||||
}
|
}
|
||||||
|
else if (at(LPAR)) {
|
||||||
|
PsiBuilder.Marker destructuringDeclaration = mark();
|
||||||
|
myKotlinParsing.parseMultiDeclarationName(TOKEN_SET_TO_FOLLOW_AFTER_DESTRUCTURING_DECLARATION_IN_LAMBDA);
|
||||||
|
destructuringDeclaration.done(DESTRUCTURING_DECLARATION);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(ARROW));
|
expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(ARROW));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1325,7 +1325,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (SimpleName (":" type)){","}
|
* (SimpleName (":" type){","})
|
||||||
*/
|
*/
|
||||||
public void parseMultiDeclarationName(TokenSet follow) {
|
public void parseMultiDeclarationName(TokenSet follow) {
|
||||||
// Parsing multi-name, e.g.
|
// Parsing multi-name, e.g.
|
||||||
|
|||||||
+1
-14
@@ -3,8 +3,6 @@ fun foo() {
|
|||||||
|
|
||||||
{(a -> a}
|
{(a -> a}
|
||||||
{(a : ) -> a}
|
{(a : ) -> a}
|
||||||
{(a : A) : -> a}
|
|
||||||
{(a) : T -> }
|
|
||||||
|
|
||||||
{(a, ) -> a}
|
{(a, ) -> a}
|
||||||
{(a : A, , a : B) -> a}
|
{(a : A, , a : B) -> a}
|
||||||
@@ -28,17 +26,6 @@ fun foo() {
|
|||||||
{(a: Int, )}
|
{(a: Int, )}
|
||||||
{a, }
|
{a, }
|
||||||
|
|
||||||
{(a) -> a}
|
|
||||||
{(a : A) -> a}
|
|
||||||
|
|
||||||
{(a : A) : T -> a}
|
|
||||||
{(a) : T -> a}
|
|
||||||
|
|
||||||
{(a, a) -> a}
|
|
||||||
{(a : A, a : B) -> a}
|
|
||||||
{(a : A, a) : T -> a}
|
|
||||||
{(a, a : B) : T -> a}
|
|
||||||
|
|
||||||
{() -> a}
|
{() -> a}
|
||||||
{() -> a}
|
{() -> a}
|
||||||
{() : T -> a}
|
{() : T -> a}
|
||||||
@@ -54,4 +41,4 @@ fun foo() {
|
|||||||
{((a: Int = object { fun t() {} }) -> Int).(x: Int) : String -> "" }
|
{((a: Int = object { fun t() {} }) -> Int).(x: Int) : String -> "" }
|
||||||
{ A.B<String>.(x: Int) -> }
|
{ A.B<String>.(x: Int) -> }
|
||||||
{((a: Boolean = true) -> Int).(x: Any) : Unit -> }
|
{((a: Boolean = true) -> Int).(x: Any) : Unit -> }
|
||||||
}
|
}
|
||||||
|
|||||||
+178
-373
@@ -30,165 +30,148 @@ JetFile: FunctionLiterals_ERR.kt
|
|||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
BLOCK
|
VALUE_PARAMETER_LIST
|
||||||
PARENTHESIZED
|
VALUE_PARAMETER
|
||||||
PsiElement(LPAR)('(')
|
DESTRUCTURING_DECLARATION
|
||||||
REFERENCE_EXPRESSION
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(IDENTIFIER)('a')
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
PsiErrorElement:Expecting ')'
|
PsiElement(IDENTIFIER)('a')
|
||||||
<empty list>
|
PsiErrorElement:Expecting ')'
|
||||||
PsiWhiteSpace(' ')
|
<empty list>
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('A')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('B')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('B')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('A')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
<empty list>
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
@@ -475,264 +458,86 @@ JetFile: FunctionLiterals_ERR.kt
|
|||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
BLOCK
|
VALUE_PARAMETER_LIST
|
||||||
PARENTHESIZED
|
VALUE_PARAMETER
|
||||||
PsiElement(LPAR)('(')
|
DESTRUCTURING_DECLARATION
|
||||||
REFERENCE_EXPRESSION
|
PsiElement(LPAR)('(')
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiErrorElement:Expecting a name
|
||||||
PsiElement(RPAR)(')')
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(RPAR)(')')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('T')
|
TYPE_REFERENCE
|
||||||
PsiWhiteSpace(' ')
|
USER_TYPE
|
||||||
PsiElement(ARROW)('->')
|
REFERENCE_EXPRESSION
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(IDENTIFIER)('T')
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(ARROW)('->')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace(' ')
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
LAMBDA_EXPRESSION
|
LAMBDA_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a name
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
BLOCK
|
BLOCK
|
||||||
PARENTHESIZED
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('B')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('A')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiErrorElement:Expecting ')'
|
|
||||||
<empty list>
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('B')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
PsiErrorElement:Expecting an expression
|
|
||||||
<empty list>
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
PsiErrorElement:Expecting an expression
|
|
||||||
<empty list>
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
PsiErrorElement:Expecting an expression
|
|
||||||
<empty list>
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
|
||||||
PsiElement(RBRACE)('}')
|
|
||||||
PsiWhiteSpace('\n ')
|
|
||||||
LAMBDA_EXPRESSION
|
|
||||||
FUNCTION_LITERAL
|
|
||||||
PsiElement(LBRACE)('{')
|
|
||||||
BLOCK
|
|
||||||
PARENTHESIZED
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
PsiErrorElement:Expecting an expression
|
|
||||||
<empty list>
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(IDENTIFIER)('a')
|
PsiElement(IDENTIFIER)('a')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
@@ -1022,4 +827,4 @@ JetFile: FunctionLiterals_ERR.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
fun foo() {
|
||||||
|
a1.filter { (x, y) -> }
|
||||||
|
a2.filter { (x) -> }
|
||||||
|
a3.filter { z, (x, y) -> }
|
||||||
|
a4.filter { (x, y), z -> }
|
||||||
|
a5.filter { q, (x, y), z -> }
|
||||||
|
a6.filter { (x, y), (z, w) -> }
|
||||||
|
|
||||||
|
a7.filter { (x, y): Type, (z: Type), (w, u: T) : V -> foo7() }
|
||||||
|
}
|
||||||
+309
@@ -0,0 +1,309 @@
|
|||||||
|
JetFile: destructuringInLambdas.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a1')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a2')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a3')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a4')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a5')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('q')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a6')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('w')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a7')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Type')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Type')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('w')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('u')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('V')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo7')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun foo() {
|
||||||
|
a8.filter { ((x, y), z) -> foo8() }
|
||||||
|
a9.filter { (x -> foo9() }
|
||||||
|
a10.filter { (x, y :) : -> foo10() }
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
JetFile: destructuringInLambdas_ERR.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a8')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PARENTHESIZED
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PARENTHESIZED
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
<empty list>
|
||||||
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo8')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a9')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo9')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
DOT_QUALIFIED_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a10')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('filter')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_ARGUMENT
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
DESTRUCTURING_DECLARATION
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DESTRUCTURING_DECLARATION_ENTRY
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo10')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -145,6 +145,18 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("destructuringInLambdas.kt")
|
||||||
|
public void testDestructuringInLambdas() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/destructuringInLambdas.kt");
|
||||||
|
doParsingTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("destructuringInLambdas_ERR.kt")
|
||||||
|
public void testDestructuringInLambdas_ERR() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/destructuringInLambdas_ERR.kt");
|
||||||
|
doParsingTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("DocCommentAfterFileAnnotations.kt")
|
@TestMetadata("DocCommentAfterFileAnnotations.kt")
|
||||||
public void testDocCommentAfterFileAnnotations() throws Exception {
|
public void testDocCommentAfterFileAnnotations() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/DocCommentAfterFileAnnotations.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/DocCommentAfterFileAnnotations.kt");
|
||||||
|
|||||||
@@ -254,7 +254,12 @@ jump
|
|||||||
// one can use "it" as a parameter name
|
// one can use "it" as a parameter name
|
||||||
functionLiteral
|
functionLiteral
|
||||||
: "{" statements "}"
|
: "{" statements "}"
|
||||||
: "{" (modifiers SimpleName (":" type)?){","} "->" statements "}"
|
: "{" lambdaParameter{","} "->" statements "}"
|
||||||
|
;
|
||||||
|
|
||||||
|
lambdaParameter
|
||||||
|
: variableDeclarationEntry
|
||||||
|
: multipleVariableDeclarations (":" type)?
|
||||||
;
|
;
|
||||||
|
|
||||||
statements
|
statements
|
||||||
|
|||||||
Reference in New Issue
Block a user