Parse annotations on lambda-argument
This commit is contained in:
@@ -477,13 +477,13 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* callSuffix
|
* callSuffix
|
||||||
* : typeArguments? valueArguments (getEntryPoint? functionLiteral*)
|
* : typeArguments? valueArguments annotatedLambda
|
||||||
* : typeArguments (getEntryPoint? functionLiteral*)
|
* : typeArguments annotatedLambda
|
||||||
* ;
|
* ;
|
||||||
*/
|
*/
|
||||||
private boolean parseCallSuffix() {
|
private boolean parseCallSuffix() {
|
||||||
if (parseCallWithClosure()) {
|
if (parseCallWithClosure()) {
|
||||||
parseCallWithClosure();
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (at(LPAR)) {
|
else if (at(LPAR)) {
|
||||||
parseValueArgumentList();
|
parseValueArgumentList();
|
||||||
@@ -529,19 +529,19 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* element (getEntryPoint? functionLiteral)?
|
* annotatedLambda*
|
||||||
*/
|
*/
|
||||||
protected boolean parseCallWithClosure() {
|
protected boolean parseCallWithClosure() {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
while (at(LBRACE) || isAtLabelDefinitionBeforeLBrace()) {
|
while (true) {
|
||||||
PsiBuilder.Marker argument = mark();
|
PsiBuilder.Marker argument = mark();
|
||||||
if (!at(LBRACE)) {
|
|
||||||
parseLabeledExpression();
|
if (!parseAnnotatedLambda(/* preferBlock = */false)) {
|
||||||
}
|
argument.drop();
|
||||||
else {
|
break;
|
||||||
parseFunctionLiteral();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
argument.done(FUNCTION_LITERAL_ARGUMENT);
|
argument.done(FUNCTION_LITERAL_ARGUMENT);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
@@ -549,6 +549,47 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* annotatedLambda
|
||||||
|
* : ("@" annotationEntry)* labelDefinition? functionLiteral
|
||||||
|
*/
|
||||||
|
private boolean parseAnnotatedLambda(boolean preferBlock) {
|
||||||
|
PsiBuilder.Marker annotated = mark();
|
||||||
|
|
||||||
|
boolean wereAnnotations = myJetParsing.parseAnnotations(ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||||
|
PsiBuilder.Marker labeled = mark();
|
||||||
|
|
||||||
|
boolean wasLabel = isAtLabelDefinitionOrMissingIdentifier();
|
||||||
|
if (wasLabel) {
|
||||||
|
parseLabelDefinition();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!at(LBRACE)) {
|
||||||
|
annotated.rollbackTo();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseFunctionLiteral(preferBlock);
|
||||||
|
|
||||||
|
doneOrDrop(labeled, LABELED_EXPRESSION, wasLabel);
|
||||||
|
doneOrDrop(annotated, ANNOTATED_EXPRESSION, wereAnnotations);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void doneOrDrop(
|
||||||
|
@NotNull PsiBuilder.Marker marker,
|
||||||
|
@NotNull IElementType type,
|
||||||
|
boolean condition
|
||||||
|
) {
|
||||||
|
if (condition) {
|
||||||
|
marker.done(type);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
marker.drop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isAtLabelDefinitionBeforeLBrace() {
|
private boolean isAtLabelDefinitionBeforeLBrace() {
|
||||||
if (at(IDENTIFIER)) {
|
if (at(IDENTIFIER)) {
|
||||||
if (myBuilder.rawLookup(1) != AT) return false;
|
if (myBuilder.rawLookup(1) != AT) return false;
|
||||||
@@ -1014,7 +1055,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
* ;
|
* ;
|
||||||
*/
|
*/
|
||||||
private void parseFunctionLiteral() {
|
private void parseFunctionLiteral() {
|
||||||
parseFunctionLiteral(false);
|
parseFunctionLiteral(/* preferBlock = */false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseFunctionLiteral(boolean preferBlock) {
|
private void parseFunctionLiteral(boolean preferBlock) {
|
||||||
@@ -1462,19 +1503,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
* If it has no ->, it's a block, otherwise a function literal
|
* If it has no ->, it's a block, otherwise a function literal
|
||||||
*/
|
*/
|
||||||
private void parseExpressionPreferringBlocks() {
|
private void parseExpressionPreferringBlocks() {
|
||||||
if (at(LBRACE)) {
|
if (!parseAnnotatedLambda(/* preferBlock = */true)) {
|
||||||
parseFunctionLiteral(true);
|
|
||||||
}
|
|
||||||
else if (isAtLabelDefinitionBeforeLBrace()) {
|
|
||||||
PsiBuilder.Marker mark = mark();
|
|
||||||
|
|
||||||
parseLabelDefinition();
|
|
||||||
|
|
||||||
parseFunctionLiteral(true);
|
|
||||||
|
|
||||||
mark.done(LABELED_EXPRESSION);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
parseExpression();
|
parseExpression();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,14 @@ public class JetFunctionLiteralArgument(node: ASTNode) : JetValueArgument(node)
|
|||||||
|
|
||||||
override fun getArgumentExpression() = super.getArgumentExpression() ?: assertFL()
|
override fun getArgumentExpression() = super.getArgumentExpression() ?: assertFL()
|
||||||
|
|
||||||
public fun getFunctionLiteral(): JetFunctionLiteralExpression {
|
public fun getFunctionLiteral(): JetFunctionLiteralExpression = unpackFunctionLiteral(getArgumentExpression())
|
||||||
val expression = getArgumentExpression()
|
|
||||||
|
|
||||||
return when (expression) {
|
private fun unpackFunctionLiteral(expression: JetExpression?): JetFunctionLiteralExpression =
|
||||||
is JetLabeledExpression -> expression.getBaseExpression() as? JetFunctionLiteralExpression ?: assertFL()
|
when (expression) {
|
||||||
else -> expression as? JetFunctionLiteralExpression ?: assertFL()
|
is JetFunctionLiteralExpression -> expression
|
||||||
}
|
is JetLabeledExpression -> unpackFunctionLiteral(expression.getBaseExpression())
|
||||||
}
|
is JetAnnotatedExpression -> unpackFunctionLiteral(expression.getBaseExpression())
|
||||||
|
else -> assertFL()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
annotation class Ann(val x: Int = 1)
|
||||||
|
|
||||||
|
inline fun bar(block: () -> Int): Int = block()
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
bar() [Ann(1)] @Ann(2) { 101 }
|
||||||
|
bar() @Ann(3) { 102 }
|
||||||
|
|
||||||
|
bar @Ann l1@ {
|
||||||
|
return@l1 103
|
||||||
|
}
|
||||||
|
|
||||||
|
bar @Ann(<!TYPE_MISMATCH!>""<!>) {
|
||||||
|
104
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
kotlin.inline() internal fun bar(/*0*/ block: () -> kotlin.Int): kotlin.Int
|
||||||
|
internal fun foo(): kotlin.Unit
|
||||||
|
|
||||||
|
internal final annotation class Ann : kotlin.Annotation {
|
||||||
|
public constructor Ann(/*0*/ x: kotlin.Int = ...)
|
||||||
|
internal final val x: kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -230,8 +230,8 @@ JetFile: Labels.kt
|
|||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
FUNCTION_LITERAL_ARGUMENT
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
LABELED_EXPRESSION
|
ANNOTATED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
FUNCTION_LITERAL_EXPRESSION
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
fun foo() {
|
||||||
|
bar @ann {
|
||||||
|
print(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar [ann] { // parsed as array access
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar @ann [ann] {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar() @ann {
|
||||||
|
print(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar() [ann] {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar() @ann [ann] {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar(@ann {
|
||||||
|
param -> param
|
||||||
|
})
|
||||||
|
|
||||||
|
if (true) @ann {
|
||||||
|
|
||||||
|
}
|
||||||
|
else [ann] @ann {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foo label@ @ann {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
JetFile: lambda.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
ARRAY_ACCESS_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INDICES
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiComment(EOL_COMMENT)('// parsed as array access')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
IF
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
CONDITION
|
||||||
|
BOOLEAN_CONSTANT
|
||||||
|
PsiElement(true)('true')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
THEN
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(else)('else')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ELSE
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(IDENTIFIER)('label')
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
fun foo() {
|
||||||
|
bar @ ann {
|
||||||
|
print(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar @ {
|
||||||
|
print(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar @ [ann] {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar [] @ {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar() @ {
|
||||||
|
print(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar() [] @ {
|
||||||
|
print(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar(@ {
|
||||||
|
param -> param
|
||||||
|
})
|
||||||
|
|
||||||
|
bar(@ ann {
|
||||||
|
param -> param
|
||||||
|
})
|
||||||
|
|
||||||
|
if (true) @ {
|
||||||
|
|
||||||
|
}
|
||||||
|
else [ann] @ ann {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
JetFile: lambdaRecovery.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
ARRAY_ACCESS_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INDICES
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
PsiErrorElement:Expecting an index element
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
PsiErrorElement:Expecting a list of annotations
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('print')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('param')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
IF
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
CONDITION
|
||||||
|
BOOLEAN_CONSTANT
|
||||||
|
PsiElement(true)('true')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
THEN
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(else)('else')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ELSE
|
||||||
|
ANNOTATED_EXPRESSION
|
||||||
|
ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -50,25 +50,32 @@ JetFile: oldSyntaxExpressions.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('x2')
|
PsiElement(IDENTIFIER)('x2')
|
||||||
PsiElement(DOT)('.')
|
PsiElement(DOT)('.')
|
||||||
REFERENCE_EXPRESSION
|
CALL_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('filter')
|
REFERENCE_EXPRESSION
|
||||||
PsiWhiteSpace(' ')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(AT)('@')
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
PsiElement(IDENTIFIER)('f')
|
ANNOTATED_EXPRESSION
|
||||||
PsiWhiteSpace(' ')
|
ANNOTATION_ENTRY
|
||||||
FUNCTION_LITERAL_EXPRESSION
|
PsiElement(AT)('@')
|
||||||
FUNCTION_LITERAL
|
CONSTRUCTOR_CALLEE
|
||||||
PsiElement(LBRACE)('{')
|
TYPE_REFERENCE
|
||||||
PsiWhiteSpace('\n ')
|
USER_TYPE
|
||||||
BLOCK
|
REFERENCE_EXPRESSION
|
||||||
RETURN
|
PsiElement(IDENTIFIER)('f')
|
||||||
PsiElement(return)('return')
|
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
PsiElement(INTEGER_LITERAL)('2')
|
FUNCTION_LITERAL
|
||||||
PsiWhiteSpace('\n ')
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(RBRACE)('}')
|
PsiWhiteSpace('\n ')
|
||||||
|
BLOCK
|
||||||
|
RETURN
|
||||||
|
PsiElement(return)('return')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n\n ')
|
PsiWhiteSpace('\n\n ')
|
||||||
RETURN
|
RETURN
|
||||||
PsiElement(return)('return')
|
PsiElement(return)('return')
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ JetFile: recovery.kt
|
|||||||
PsiElement(IDENTIFIER)('filter')
|
PsiElement(IDENTIFIER)('filter')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
FUNCTION_LITERAL_ARGUMENT
|
FUNCTION_LITERAL_ARGUMENT
|
||||||
LABELED_EXPRESSION
|
ANNOTATED_EXPRESSION
|
||||||
PsiErrorElement:Label must be named
|
PsiErrorElement:Expected annotation identifier after '@'
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
FUNCTION_LITERAL_EXPRESSION
|
FUNCTION_LITERAL_EXPRESSION
|
||||||
|
|||||||
@@ -639,6 +639,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("annotationsOnLambdaAsCallArgument.kt")
|
||||||
|
public void testAnnotationsOnLambdaAsCallArgument() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("atAnnotationResolve.kt")
|
@TestMetadata("atAnnotationResolve.kt")
|
||||||
public void testAtAnnotationResolve() throws Exception {
|
public void testAtAnnotationResolve() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt");
|
||||||
|
|||||||
@@ -651,6 +651,18 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
|||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambda.kt")
|
||||||
|
public void testLambda() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/lambda.kt");
|
||||||
|
doParsingTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaRecovery.kt")
|
||||||
|
public void testLambdaRecovery() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/lambdaRecovery.kt");
|
||||||
|
doParsingTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ShortAnnotations.kt")
|
@TestMetadata("ShortAnnotations.kt")
|
||||||
public void testShortAnnotations() throws Exception {
|
public void testShortAnnotations() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/ShortAnnotations.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/ShortAnnotations.kt");
|
||||||
|
|||||||
@@ -225,10 +225,13 @@ postfixUnaryOperation
|
|||||||
;
|
;
|
||||||
|
|
||||||
callSuffix
|
callSuffix
|
||||||
: typeArguments? valueArguments (labelDefinition? functionLiteral)
|
: typeArguments? valueArguments annotatedLambda
|
||||||
: typeArguments (labelDefinition? functionLiteral)
|
: typeArguments annotatedLambda
|
||||||
;
|
;
|
||||||
|
|
||||||
|
annotatedLambda
|
||||||
|
: ("@" annotationEntry)* labelDefinition? functionLiteral
|
||||||
|
|
||||||
memberAccessOperation
|
memberAccessOperation
|
||||||
: "." : "?." : "?"
|
: "." : "?." : "?"
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user