diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java index 6510b1ed12a..5429a009bca 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java @@ -33,7 +33,6 @@ import java.util.Set; import static org.jetbrains.kotlin.JetNodeTypes.*; import static org.jetbrains.kotlin.lexer.JetTokens.*; -import static org.jetbrains.kotlin.parsing.JetParsing.AnnotationParsingMode.ALLOW_UNESCAPED_REGULAR_ANNOTATIONS; import static org.jetbrains.kotlin.parsing.JetParsing.AnnotationParsingMode.ONLY_ESCAPED_REGULAR_ANNOTATIONS; import static org.jetbrains.kotlin.parsing.JetParsing.DeclarationParsingMode.LOCAL; @@ -846,14 +845,14 @@ public class JetExpressionParsing extends AbstractJetParsing { if (at(LPAR)) { advanceAt(LPAR); - int valPos = matchTokenStreamPredicate(new FirstBefore(new At(VAL_KEYWORD), new AtSet(RPAR, LBRACE, RBRACE, SEMICOLON, EQ))); - if (valPos >= 0) { - PsiBuilder.Marker property = mark(); - myJetParsing.parseModifierList(ALLOW_UNESCAPED_REGULAR_ANNOTATIONS); + PsiBuilder.Marker property = mark(); + myJetParsing.parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.create(EQ, RPAR)); + if (at(VAL_KEYWORD) || at(VAR_KEYWORD)) { myJetParsing.parseProperty(true); property.done(PROPERTY); } else { + property.rollbackTo(); parseExpression(); } @@ -1035,7 +1034,7 @@ public class JetExpressionParsing extends AbstractJetParsing { private boolean parseLocalDeclaration() { PsiBuilder.Marker decl = mark(); JetParsing.ModifierDetector detector = new JetParsing.ModifierDetector(); - myJetParsing.parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS); + myJetParsing.parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.EMPTY); IElementType declType = parseLocalDeclarationRest(detector.isEnumDetected()); @@ -1343,9 +1342,7 @@ public class JetExpressionParsing extends AbstractJetParsing { PsiBuilder.Marker parameter = mark(); if (!at(IN_KEYWORD)) { - myJetParsing.parseModifierListWithUnescapedAnnotations( - TokenSet.create(IDENTIFIER, LPAR), TokenSet.create(IN_KEYWORD, RPAR, COLON) - ); + myJetParsing.parseModifierListWithLookForStopAt(TokenSet.create(IDENTIFIER, LPAR), TokenSet.create(IN_KEYWORD, RPAR, COLON)); } if (at(VAL_KEYWORD) || at(VAR_KEYWORD)) advance(); // VAL_KEYWORD or VAR_KEYWORD diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index cd0b56822bd..9a23d0ec6a5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -196,7 +196,7 @@ public class JetParsing extends AbstractJetParsing { * ; */ PsiBuilder.Marker packageDirective = mark(); - parseModifierList(ALLOW_UNESCAPED_REGULAR_ANNOTATIONS); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.EMPTY); if (at(PACKAGE_KEYWORD)) { advance(); // PACKAGE_KEYWORD @@ -391,7 +391,7 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker decl = mark(); ModifierDetector detector = new ModifierDetector(); - parseModifierList(detector, ALLOW_UNESCAPED_REGULAR_ANNOTATIONS); + parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.EMPTY); IElementType keywordToken = tt(); IElementType declType = null; @@ -434,9 +434,10 @@ public class JetParsing extends AbstractJetParsing { * (modifier | annotation)* */ boolean parseModifierList( - @NotNull AnnotationParsingMode annotationParsingMode + @NotNull AnnotationParsingMode annotationParsingMode, + @Nullable TokenSet noModifiersBefore ) { - return parseModifierList(null, annotationParsingMode); + return parseModifierList(null, annotationParsingMode, noModifiersBefore); } /** @@ -446,7 +447,8 @@ public class JetParsing extends AbstractJetParsing { */ boolean parseModifierList( @Nullable Consumer tokenConsumer, - @NotNull AnnotationParsingMode annotationParsingMode + @NotNull AnnotationParsingMode annotationParsingMode, + @Nullable TokenSet noModifiersBefore ) { PsiBuilder.Marker list = mark(); boolean empty = true; @@ -458,7 +460,7 @@ public class JetParsing extends AbstractJetParsing { if (at(AT) && annotationParsingMode.allowAnnotations) { parseAnnotationOrList(annotationParsingMode); } - else if (tryParseModifier(tokenConsumer)) { + else if (tryParseModifier(tokenConsumer, noModifiersBefore)) { // modifier advanced } else if (annotationParsingMode.allowShortAnnotations && at(IDENTIFIER)) { @@ -479,17 +481,20 @@ public class JetParsing extends AbstractJetParsing { return !empty; } - private boolean tryParseModifier(@Nullable Consumer tokenConsumer) { + private boolean tryParseModifier(@Nullable Consumer tokenConsumer, @Nullable TokenSet noModifiersBefore) { PsiBuilder.Marker marker = mark(); if (atSet(MODIFIER_KEYWORDS)) { - IElementType tt = tt(); - if (tokenConsumer != null) { - tokenConsumer.consume(tt); + IElementType lookahead = lookahead(1); + if (noModifiersBefore == null || lookahead != null && !noModifiersBefore.contains(lookahead)) { + IElementType tt = tt(); + if (tokenConsumer != null) { + tokenConsumer.consume(tt); + } + advance(); // MODIFIER + marker.collapse(tt); + return true; } - advance(); // MODIFIER - marker.collapse(tt); - return true; } marker.rollbackTo(); @@ -805,7 +810,8 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker beforeConstructorModifiers = mark(); PsiBuilder.Marker primaryConstructorMarker = mark(); boolean hasConstructorModifiers = parseModifierList( - declarationParsingMode != LOCAL ? PRIMARY_CONSTRUCTOR_MODIFIER_LIST : PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL + declarationParsingMode != LOCAL ? PRIMARY_CONSTRUCTOR_MODIFIER_LIST : PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL, + TokenSet.EMPTY ); // Some modifiers found, but no parentheses following: class has already ended, and we are looking at something else @@ -945,7 +951,7 @@ public class JetParsing extends AbstractJetParsing { private ParseEnumEntryResult parseEnumEntry() { PsiBuilder.Marker entry = mark(); - parseModifierListWithStopAt(TokenSet.create(COMMA, SEMICOLON, RBRACE), ONLY_ESCAPED_REGULAR_ANNOTATIONS); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.create(COMMA, COLON, SEMICOLON, RBRACE)); if (!atSet(SOFT_KEYWORDS_AT_MEMBER_START) && at(IDENTIFIER)) { PsiBuilder.Marker nameAsDeclaration = mark(); @@ -1052,7 +1058,7 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker decl = mark(); ModifierDetector detector = new ModifierDetector(); - parseModifierList(detector, ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST); + parseModifierList(detector, ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST, TokenSet.EMPTY); IElementType declType = parseMemberDeclarationRest(detector.isEnumDetected(), detector.isDefaultDetected()); @@ -1177,33 +1183,6 @@ public class JetParsing extends AbstractJetParsing { mark.done(CONSTRUCTOR_DELEGATION_REFERENCE); } - /* - * initializer - * : annotations constructorInvocation // type parameters may (must?) be omitted - * ; - */ - private void parseInitializer() { - PsiBuilder.Marker initializer = mark(); - parseAnnotations(ONLY_ESCAPED_REGULAR_ANNOTATIONS); - - IElementType type; - if (atSet(TYPE_REF_FIRST)) { - PsiBuilder.Marker reference = mark(); - parseTypeRef(); - reference.done(CONSTRUCTOR_CALLEE); - type = DELEGATOR_SUPER_CALL; - } - else { - errorWithRecovery("Expecting constructor call ((...))", - TokenSet.orSet(TOP_LEVEL_DECLARATION_FIRST, TokenSet.create(RBRACE, LBRACE, COMMA, SEMICOLON))); - initializer.drop(); - return; - } - myExpressionParsing.parseValueArgumentList(); - - initializer.done(type); - } - /* * typeAlias * : modifiers "typealias" SimpleName (typeParameters typeConstraints)? "=" type @@ -1248,12 +1227,8 @@ public class JetParsing extends AbstractJetParsing { } public IElementType parseProperty(boolean local) { - if (at(VAL_KEYWORD) || at(VAR_KEYWORD)) { - advance(); // VAL_KEYWORD or VAR_KEYWORD - } - else { - errorAndAdvance("Expecting 'val' or 'var'"); - } + assert (at(VAL_KEYWORD) || at(VAR_KEYWORD)); + advance(); boolean typeParametersDeclared = at(LT) && parseTypeParameterList(TokenSet.create(IDENTIFIER, EQ, COLON, SEMICOLON)); @@ -1359,7 +1334,7 @@ public class JetParsing extends AbstractJetParsing { } PsiBuilder.Marker property = mark(); - parseModifierListWithUnescapedAnnotations(TokenSet.create(COMMA, RPAR, COLON, IN_KEYWORD, EQ)); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.create(COMMA, RPAR, COLON, IN_KEYWORD, EQ)); expect(IDENTIFIER, "Expecting a name", recoverySet); @@ -1391,7 +1366,7 @@ public class JetParsing extends AbstractJetParsing { private boolean parsePropertyGetterOrSetter() { PsiBuilder.Marker getterOrSetter = mark(); - parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.EMPTY); if (!at(GET_KEYWORD) && !at(SET_KEYWORD)) { getterOrSetter.rollbackTo(); @@ -1418,7 +1393,7 @@ public class JetParsing extends AbstractJetParsing { if (setter) { PsiBuilder.Marker parameterList = mark(); PsiBuilder.Marker setterParameter = mark(); - parseModifierListWithUnescapedAnnotations(TokenSet.create(RPAR, COMMA, COLON)); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.create(COMMA, COLON, RPAR)); expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(RPAR, COLON, LBRACE, EQ)); if (at(COLON)) { @@ -1804,7 +1779,7 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker mark = mark(); - parseModifierListWithUnescapedAnnotations(TokenSet.create(COMMA, GT, COLON)); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, TokenSet.create(GT, COMMA, COLON)); expect(IDENTIFIER, "Type parameter name expected", TokenSet.EMPTY); @@ -2085,7 +2060,7 @@ public class JetParsing extends AbstractJetParsing { // TokenSet stopAt = TokenSet.create(COMMA, COLON, GT); // parseModifierListWithUnescapedAnnotations(MODIFIER_LIST, lookFor, stopAt); // Currently we do not allow annotations - parseModifierList(NO_ANNOTATIONS); + parseModifierList(NO_ANNOTATIONS, TokenSet.create(COMMA, COLON, GT)); if (at(MUL)) { advance(); // MUL @@ -2109,21 +2084,9 @@ public class JetParsing extends AbstractJetParsing { return atGT; } - public void parseModifierListWithUnescapedAnnotations(TokenSet stopAt) { - parseModifierListWithLookForStopAt(TokenSet.create(IDENTIFIER), stopAt, ALLOW_UNESCAPED_REGULAR_ANNOTATIONS); - } - - public void parseModifierListWithStopAt(TokenSet stopAt, AnnotationParsingMode mode) { - parseModifierListWithLookForStopAt(TokenSet.create(IDENTIFIER), stopAt, mode); - } - - public void parseModifierListWithUnescapedAnnotations(TokenSet lookFor, TokenSet stopAt) { - parseModifierListWithLookForStopAt(lookFor, stopAt, ALLOW_UNESCAPED_REGULAR_ANNOTATIONS); - } - - public void parseModifierListWithLookForStopAt(TokenSet lookFor, TokenSet stopAt, AnnotationParsingMode mode) { + public void parseModifierListWithLookForStopAt(TokenSet lookFor, TokenSet stopAt) { int lastId = matchTokenStreamPredicate(new LastBefore(new AtSet(lookFor), new AnnotationTargetStop(stopAt, ANNOTATION_TARGETS), false)); - createTruncatedBuilder(lastId).parseModifierList(mode); + createTruncatedBuilder(lastId).parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, null); } private class AnnotationTargetStop extends AbstractTokenStreamPredicate { @@ -2174,6 +2137,8 @@ public class JetParsing extends AbstractJetParsing { return functionType; } + private static final TokenSet NO_MODIFIER_BEFORE_FOR_VALUE_PARAMETER = TokenSet.create(COMMA, COLON, EQ, RPAR); + /* * functionParameters * : "(" functionParameter{","}? ")" // default values @@ -2207,7 +2172,7 @@ public class JetParsing extends AbstractJetParsing { if (isFunctionTypeContents) { if (!tryParseValueParameter(typeRequired)) { PsiBuilder.Marker valueParameter = mark(); - parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS); // lazy, out, ref + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, NO_MODIFIER_BEFORE_FOR_VALUE_PARAMETER); // lazy, out, ref parseTypeRef(); closeDeclarationWithCommentBinders(valueParameter, VALUE_PARAMETER, false); } @@ -2248,7 +2213,7 @@ public class JetParsing extends AbstractJetParsing { private boolean parseValueParameter(boolean rollbackOnFailure, boolean typeRequired) { PsiBuilder.Marker parameter = mark(); - parseModifierListWithUnescapedAnnotations(TokenSet.create(COMMA, RPAR)); + parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS, NO_MODIFIER_BEFORE_FOR_VALUE_PARAMETER); if (at(VAR_KEYWORD) || at(VAL_KEYWORD)) { advance(); // VAR_KEYWORD | VAL_KEYWORD diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetProperty.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetProperty.java index 9f71540982d..c786bb0be57 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetProperty.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetProperty.java @@ -275,7 +275,7 @@ public class JetProperty extends JetTypeParameterListOwnerStubvarargs f : Int) {} +fun foo(@varargs f : Int) {} var bar : Int = 1 - set(varargs v) {} + set(@varargs v) {} val x : (Int) -> Int = {@varargs x : Int -> x} -class Hello(varargs args: Any) { +class Hello(@varargs args: Any) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/imports/SyntaxError.kt b/compiler/testData/diagnostics/tests/imports/SyntaxError.kt index 7fc5d809454..f46b613e4c1 100644 --- a/compiler/testData/diagnostics/tests/imports/SyntaxError.kt +++ b/compiler/testData/diagnostics/tests/imports/SyntaxError.kt @@ -57,4 +57,4 @@ import a.%.b.c. import a.b.c.D. import a.b.c.D.E. -import a?.b \ No newline at end of file +import a?.b \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/recovery/namelessMembers.kt b/compiler/testData/diagnostics/tests/recovery/namelessMembers.kt index 1c488065a92..a11d5649f11 100644 --- a/compiler/testData/diagnostics/tests/recovery/namelessMembers.kt +++ b/compiler/testData/diagnostics/tests/recovery/namelessMembers.kt @@ -12,6 +12,6 @@ class C { enum class {} } -class C1> {} +class C1<in> {} class C2(val) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/recovery/namelessMembers.txt b/compiler/testData/diagnostics/tests/recovery/namelessMembers.txt index bc60b988819..30c442ba16d 100644 --- a/compiler/testData/diagnostics/tests/recovery/namelessMembers.txt +++ b/compiler/testData/diagnostics/tests/recovery/namelessMembers.txt @@ -31,8 +31,8 @@ public final class C { } } -public final class C1> { - public constructor C1>() +public final class C1> { + public constructor C1>() 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 diff --git a/compiler/testData/diagnostics/tests/regressions/ea66984.kt b/compiler/testData/diagnostics/tests/regressions/ea66984.kt index 776c63fa07f..f7c697ccb04 100644 --- a/compiler/testData/diagnostics/tests/regressions/ea66984.kt +++ b/compiler/testData/diagnostics/tests/regressions/ea66984.kt @@ -1,2 +1,2 @@ // !DIAGNOSTICS: -NO_VALUE_FOR_PARAMETER -class Tree(T element, Tree left, Tree right) {} \ No newline at end of file +class Tree<T>(T element, Tree left, Tree right) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/ea66984.txt b/compiler/testData/diagnostics/tests/regressions/ea66984.txt index 144b2c4aef7..d3aad10db4c 100644 --- a/compiler/testData/diagnostics/tests/regressions/ea66984.txt +++ b/compiler/testData/diagnostics/tests/regressions/ea66984.txt @@ -1,7 +1,7 @@ package public final class Tree { - public constructor Tree(/*0*/ @[ERROR : Not an annotation: T]() element: [ERROR : Type annotation was missing for parameter element], /*1*/ @Tree() left: [ERROR : Type annotation was missing for parameter left], /*2*/ @Tree() right: [ERROR : Type annotation was missing for parameter right]) + public constructor Tree(/*0*/ T: [ERROR : Type annotation was missing for parameter T], /*1*/ : Tree, /*2*/ left: [ERROR : Type annotation was missing for parameter left], /*3*/ : Tree, /*4*/ right: [ERROR : Type annotation was missing for parameter right]) 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 diff --git a/compiler/testData/psi/DynamicSoftKeyword.txt b/compiler/testData/psi/DynamicSoftKeyword.txt index caab8a03a00..036470a4a92 100644 --- a/compiler/testData/psi/DynamicSoftKeyword.txt +++ b/compiler/testData/psi/DynamicSoftKeyword.txt @@ -3,17 +3,10 @@ JetFile: DynamicSoftKeyword.kt IMPORT_LIST + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('dynamic') + PsiWhiteSpace(' ') CLASS - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('dynamic') - PsiWhiteSpace(' ') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('dynamic') diff --git a/compiler/testData/psi/EnumWithAnnotationKeyword.txt b/compiler/testData/psi/EnumWithAnnotationKeyword.txt index ae12b5688b2..a8f72363cfa 100644 --- a/compiler/testData/psi/EnumWithAnnotationKeyword.txt +++ b/compiler/testData/psi/EnumWithAnnotationKeyword.txt @@ -24,23 +24,17 @@ JetFile: EnumWithAnnotationKeyword.kt PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n') + MODIFIER_LIST + PsiElement(enum)('enum') + PsiWhiteSpace(' ') + PsiElement(annotation)('annotation') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('E1') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiElement(enum)('enum') - PsiWhiteSpace(' ') - PsiElement(annotation)('annotation') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E1') PsiErrorElement:Expecting a top level declaration - PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/FileStart_ERR.txt b/compiler/testData/psi/FileStart_ERR.txt index 94bb0be977d..b4c1f07c275 100644 --- a/compiler/testData/psi/FileStart_ERR.txt +++ b/compiler/testData/psi/FileStart_ERR.txt @@ -8,36 +8,15 @@ JetFile: FileStart_ERR.kt PsiErrorElement:Expecting a top level declaration PsiElement(package)('package') PsiWhiteSpace(' ') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('import') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') PsiErrorElement:Expecting a top level declaration - + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('import') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') \ No newline at end of file diff --git a/compiler/testData/psi/ParameterNameMising.txt b/compiler/testData/psi/ParameterNameMising.txt index ab75fd2f2ed..cc3d96a7420 100644 --- a/compiler/testData/psi/ParameterNameMising.txt +++ b/compiler/testData/psi/ParameterNameMising.txt @@ -72,25 +72,20 @@ JetFile: ParameterNameMising.kt VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Array') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('String') - PsiElement(GT)('>') PsiErrorElement:Parameter name expected + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Array') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/ParameterType_ERR.txt b/compiler/testData/psi/ParameterType_ERR.txt index 78bc263d4e2..552a302243d 100644 --- a/compiler/testData/psi/ParameterType_ERR.txt +++ b/compiler/testData/psi/ParameterType_ERR.txt @@ -33,15 +33,8 @@ JetFile: ParameterType_ERR.kt PsiErrorElement:Expecting ')' PsiElement(LPAR)('(') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('InlineOp') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('InlineOp') PsiErrorElement:Expecting a top level declaration PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration @@ -67,15 +60,8 @@ JetFile: ParameterType_ERR.kt PsiErrorElement:Expecting ')' PsiElement(LPAR)('(') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parameter') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('parameter') PsiErrorElement:Expecting a top level declaration PsiElement(RPAR)(')') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/Properties_ERR.txt b/compiler/testData/psi/Properties_ERR.txt index 8e4a6ae3c86..f306fdc0117 100644 --- a/compiler/testData/psi/Properties_ERR.txt +++ b/compiler/testData/psi/Properties_ERR.txt @@ -185,17 +185,10 @@ JetFile: Properties_ERR.kt PsiErrorElement:Expecting a top level declaration PsiElement(EQ)('=') PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n\n') PROPERTY - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace('\n\n') PsiElement(val)('val') PsiWhiteSpace(' ') TYPE_REFERENCE diff --git a/compiler/testData/psi/RootPackage.txt b/compiler/testData/psi/RootPackage.txt index fa75ee9078f..2407dd8f5bb 100644 --- a/compiler/testData/psi/RootPackage.txt +++ b/compiler/testData/psi/RootPackage.txt @@ -20,23 +20,16 @@ JetFile: RootPackage.kt PsiErrorElement:Expecting a top level declaration PsiElement(package)('package') PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') PsiErrorElement:Expecting a top level declaration - PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/SimpleModifiers.txt b/compiler/testData/psi/SimpleModifiers.txt index ac5a881d23e..b9e3e4aa807 100644 --- a/compiler/testData/psi/SimpleModifiers.txt +++ b/compiler/testData/psi/SimpleModifiers.txt @@ -15,43 +15,37 @@ JetFile: SimpleModifiers.kt IMPORT_LIST PsiWhiteSpace('\n\n') + MODIFIER_LIST + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(annotation)('annotation') + PsiWhiteSpace('\n') + PsiElement(override)('override') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(private)('private') + PsiWhiteSpace('\n') + PsiElement(protected)('protected') + PsiWhiteSpace('\n') + PsiElement(public)('public') + PsiWhiteSpace('\n') + PsiElement(internal)('internal') + PsiWhiteSpace('\n') + PsiElement(in)('in') + PsiWhiteSpace('\n') + PsiElement(out)('out') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace('\n ') CLASS - MODIFIER_LIST - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(annotation)('annotation') - PsiWhiteSpace('\n') - PsiElement(override)('override') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(private)('private') - PsiWhiteSpace('\n') - PsiElement(protected)('protected') - PsiWhiteSpace('\n') - PsiElement(public)('public') - PsiWhiteSpace('\n') - PsiElement(internal)('internal') - PsiWhiteSpace('\n') - PsiElement(in)('in') - PsiWhiteSpace('\n') - PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('Bar') @@ -86,20 +80,18 @@ JetFile: SimpleModifiers.kt PsiElement(in)('in') PsiWhiteSpace('\n ') PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace(' ') + PsiWhiteSpace('\n ') + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace(' ') + PsiErrorElement:Missing '>' PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - CLASS_BODY + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + FUN + PsiErrorElement:Expecting a top level declaration + + BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') PROPERTY diff --git a/compiler/testData/psi/SoftKeywords.txt b/compiler/testData/psi/SoftKeywords.txt index 4bd243e95d2..748cfc5c25c 100644 --- a/compiler/testData/psi/SoftKeywords.txt +++ b/compiler/testData/psi/SoftKeywords.txt @@ -20,51 +20,45 @@ JetFile: SoftKeywords.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n\n') + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(protected)('protected') + PsiWhiteSpace(' ') + PsiElement(private)('private') + PsiWhiteSpace(' ') + PsiElement(internal)('internal') + PsiWhiteSpace('\n') + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(annotation)('annotation') + PsiWhiteSpace('\n') + PsiElement(override)('override') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(private)('private') + PsiWhiteSpace('\n') + PsiElement(protected)('protected') + PsiWhiteSpace('\n') + PsiElement(public)('public') + PsiWhiteSpace('\n') + PsiElement(internal)('internal') + PsiWhiteSpace('\n') + PsiElement(in)('in') + PsiWhiteSpace('\n') + PsiElement(out)('out') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace('\n ') CLASS - MODIFIER_LIST - PsiElement(public)('public') - PsiWhiteSpace(' ') - PsiElement(protected)('protected') - PsiWhiteSpace(' ') - PsiElement(private)('private') - PsiWhiteSpace(' ') - PsiElement(internal)('internal') - PsiWhiteSpace('\n') - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(annotation)('annotation') - PsiWhiteSpace('\n') - PsiElement(override)('override') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(private)('private') - PsiWhiteSpace('\n') - PsiElement(protected)('protected') - PsiWhiteSpace('\n') - PsiElement(public)('public') - PsiWhiteSpace('\n') - PsiElement(internal)('internal') - PsiWhiteSpace('\n') - PsiElement(in)('in') - PsiWhiteSpace('\n') - PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace('\n ') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('Bar') diff --git a/compiler/testData/psi/annotation/Annotations.txt b/compiler/testData/psi/annotation/Annotations.txt index 347a7bf6d37..ba9a06ea3a2 100644 --- a/compiler/testData/psi/annotation/Annotations.txt +++ b/compiler/testData/psi/annotation/Annotations.txt @@ -15,39 +15,103 @@ JetFile: Annotations.kt IMPORT_LIST PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(enum)('enum') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(annotation)('annotation') - PsiWhiteSpace('\n') - PsiElement(override)('override') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(private)('private') - PsiWhiteSpace('\n') - PsiElement(protected)('protected') - PsiWhiteSpace('\n') - PsiElement(public)('public') - PsiWhiteSpace('\n') - PsiElement(internal)('internal') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE + MODIFIER_LIST + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(enum)('enum') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(annotation)('annotation') + PsiWhiteSpace('\n') + PsiElement(override)('override') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(private)('private') + PsiWhiteSpace('\n') + PsiElement(protected)('protected') + PsiWhiteSpace('\n') + PsiElement(public)('public') + PsiWhiteSpace('\n') + PsiElement(internal)('internal') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + 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)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ina') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE USER_TYPE + USER_TYPE + USER_TYPE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('goo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('doo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + PsiElement(GT)('>') + PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') TYPE_ARGUMENT_LIST @@ -56,120 +120,50 @@ JetFile: Annotations.kt TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') + PsiElement(IDENTIFIER)('bar') PsiElement(COMMA)(',') PsiWhiteSpace(' ') TYPE_PROJECTION TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('goo') PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT + PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ina') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('goo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('doo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('goo') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('df') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(in)('in') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('sdfsdf') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace('\n ') + PsiElement(IDENTIFIER)('df') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(in)('in') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('sdfsdf') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(out)('out') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace('\n ') + CLASS PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('Bar') @@ -324,20 +318,18 @@ JetFile: Annotations.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace(' ') + PsiWhiteSpace('\n') + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace(' ') + PsiErrorElement:Missing '>' PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - CLASS_BODY + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + FUN + PsiErrorElement:Expecting a top level declaration + + BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/Annotations_ERR.txt b/compiler/testData/psi/annotation/Annotations_ERR.txt index 9d227439eb8..f38e30a0d99 100644 --- a/compiler/testData/psi/annotation/Annotations_ERR.txt +++ b/compiler/testData/psi/annotation/Annotations_ERR.txt @@ -15,46 +15,112 @@ JetFile: Annotations_ERR.kt IMPORT_LIST PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(enum)('enum') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(annotation)('annotation') - PsiWhiteSpace('\n') - PsiElement(override)('override') - PsiWhiteSpace('\n') - PsiElement(open)('open') - PsiWhiteSpace('\n') - PsiElement(abstract)('abstract') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting a list of annotations - - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(private)('private') - PsiWhiteSpace('\n') - PsiElement(protected)('protected') - PsiWhiteSpace('\n') - PsiElement(public)('public') - PsiWhiteSpace('\n') - PsiElement(internal)('internal') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE + MODIFIER_LIST + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(enum)('enum') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(annotation)('annotation') + PsiWhiteSpace('\n') + PsiElement(override)('override') + PsiWhiteSpace('\n') + PsiElement(open)('open') + PsiWhiteSpace('\n') + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + PsiErrorElement:Expecting a list of annotations + + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(private)('private') + PsiWhiteSpace('\n') + PsiElement(protected)('protected') + PsiWhiteSpace('\n') + PsiElement(public)('public') + PsiWhiteSpace('\n') + PsiElement(internal)('internal') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + 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)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiErrorElement:No commas needed to separate annotations + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ina') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE USER_TYPE + USER_TYPE + USER_TYPE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('goo') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('doo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + PsiElement(GT)('>') + PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') TYPE_ARGUMENT_LIST @@ -63,151 +129,79 @@ JetFile: Annotations_ERR.kt TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') + PsiElement(IDENTIFIER)('bar') PsiElement(COMMA)(',') PsiWhiteSpace(' ') TYPE_PROJECTION TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('goo') PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT + PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RPAR)(')') - PsiErrorElement:No commas needed to separate annotations - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ina') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('goo') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('doo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('goo') - PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('df') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(in)('in') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('sdfsdf') - PsiWhiteSpace(' ') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('s') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('fd') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('d') - PsiErrorElement:No commas needed to separate annotations - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') + PsiElement(IDENTIFIER)('foo') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace('\n ') + PsiElement(IDENTIFIER)('df') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(in)('in') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('sdfsdf') + PsiWhiteSpace(' ') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('s') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('fd') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('d') + PsiErrorElement:No commas needed to separate annotations + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(out)('out') + PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace('\n ') + CLASS PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('Bar') @@ -279,20 +273,18 @@ JetFile: Annotations_ERR.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ref') - PsiWhiteSpace(' ') + PsiWhiteSpace('\n') + PsiElement(IDENTIFIER)('ref') + PsiWhiteSpace(' ') + PsiErrorElement:Missing '>' PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - CLASS_BODY + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiWhiteSpace(' ') + FUN + PsiErrorElement:Expecting a top level declaration + + BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/ShortAnnotations.kt b/compiler/testData/psi/annotation/ShortAnnotations.kt index 1d4d3c1c1a2..df55d9252e0 100644 --- a/compiler/testData/psi/annotation/ShortAnnotations.kt +++ b/compiler/testData/psi/annotation/ShortAnnotations.kt @@ -21,6 +21,10 @@ class Foo { } fun test() { + when (@foo @bar(1) @buzz(1) @zoo val a = 1) { + 1 -> 1 + } + when (foo bar(1) buzz(1) zoo val a = 1) { 1 -> 1 } diff --git a/compiler/testData/psi/annotation/ShortAnnotations.txt b/compiler/testData/psi/annotation/ShortAnnotations.txt index 0ad16a933f4..371f384b107 100644 --- a/compiler/testData/psi/annotation/ShortAnnotations.txt +++ b/compiler/testData/psi/annotation/ShortAnnotations.txt @@ -1,252 +1,146 @@ JetFile: ShortAnnotations.kt PACKAGE_DIRECTIVE - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') - PsiElement(package)('package') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('aa') + IMPORT_LIST + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(package)('package') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('aa') PsiWhiteSpace('\n\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') CLASS - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('A') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') OBJECT_DECLARATION - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(object)('object') PsiWhiteSpace(' ') OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('B') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(fun)('fun') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a') @@ -258,64 +152,37 @@ JetFile: ShortAnnotations.kt PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') PROPERTY - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(val)('val') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('c') @@ -332,64 +199,37 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('0') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') PROPERTY - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(var)('var') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('v') @@ -406,64 +246,37 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('0') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') TYPEDEF - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') PsiElement(typealias)('typealias') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('T') @@ -1043,18 +856,16 @@ JetFile: ShortAnnotations.kt PsiElement(LPAR)('(') PROPERTY MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Use '@' symbol before annotations - PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -1066,10 +877,9 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -1089,10 +899,9 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') - PsiErrorElement:Use '@' symbol before annotations - PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -1122,5 +931,68 @@ JetFile: ShortAnnotations.kt PsiElement(INTEGER_LITERAL)('1') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + WHEN + PsiElement(when)('when') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + BINARY_EXPRESSION + BINARY_EXPRESSION + BINARY_EXPRESSION + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('bar') + PARENTHESIZED + PsiElement(LPAR)('(') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('buzz') + PsiErrorElement:Expecting an element + PsiElement(LT)('<') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('T') + CALL_EXPRESSION + PsiErrorElement:Expecting an element + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('zoo') + PsiWhiteSpace(' ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + WHEN_ENTRY + WHEN_CONDITION_WITH_EXPRESSION + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') diff --git a/compiler/testData/psi/annotation/forParameters.kt b/compiler/testData/psi/annotation/forParameters.kt index 6bd5dfc7b11..966d52d3fd0 100644 --- a/compiler/testData/psi/annotation/forParameters.kt +++ b/compiler/testData/psi/annotation/forParameters.kt @@ -8,14 +8,14 @@ fun foo() { for ((@[ann], x) in pair) {} - for (Volatile x in 1..100) {} - for (Volatile(1) x in 1..100) {} - for (Volatile() (x, Volatile y) in 1..100) {} - for (Volatile (x, Volatile y) in 1..100) {} + for (@Volatile x in 1..100) {} + for (@Volatile(1) x in 1..100) {} + for (@Volatile() (x, @Volatile y) in 1..100) {} + for (@Volatile (x, @Volatile y) in 1..100) {} - for (Volatile var x in 1..100) {} - for (Volatile val (x, Volatile y) in 1..100) {} + for (@Volatile var x in 1..100) {} + for (@Volatile val (x, @Volatile y) in 1..100) {} - for (private Volatile var x in 1..100) {} - for (private Volatile val (x, Volatile y) in 1..100) {} + for (private @Volatile var x in 1..100) {} + for (private @Volatile val (x, @Volatile y) in 1..100) {} } diff --git a/compiler/testData/psi/annotation/forParameters.txt b/compiler/testData/psi/annotation/forParameters.txt index f1ff2dc4f10..037c9d33d76 100644 --- a/compiler/testData/psi/annotation/forParameters.txt +++ b/compiler/testData/psi/annotation/forParameters.txt @@ -78,19 +78,11 @@ JetFile: forParameters.kt PsiElement(AT)('@') PsiWhiteSpace(' ') PsiElement(in)('in') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('z') - PsiErrorElement:Expecting a variable name - PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('z') PsiErrorElement:Expecting 'in' + PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY BLOCK @@ -191,9 +183,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -225,9 +216,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -265,9 +255,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -284,9 +273,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -319,9 +307,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -335,9 +322,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -370,9 +356,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -406,9 +391,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -424,9 +408,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -460,10 +443,9 @@ JetFile: forParameters.kt VALUE_PARAMETER MODIFIER_LIST PsiElement(private)('private') - PsiErrorElement:Use '@' symbol before annotations - PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -498,10 +480,9 @@ JetFile: forParameters.kt MULTI_VARIABLE_DECLARATION MODIFIER_LIST PsiElement(private)('private') - PsiErrorElement:Use '@' symbol before annotations - PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -517,9 +498,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/annotation/noParameterYet.kt b/compiler/testData/psi/annotation/noParameterYet.kt new file mode 100644 index 00000000000..589e792cfc0 --- /dev/null +++ b/compiler/testData/psi/annotation/noParameterYet.kt @@ -0,0 +1 @@ +fun foo(@Deprecated) \ No newline at end of file diff --git a/compiler/testData/psi/annotation/noParameterYet.txt b/compiler/testData/psi/annotation/noParameterYet.txt new file mode 100644 index 00000000000..662f125460a --- /dev/null +++ b/compiler/testData/psi/annotation/noParameterYet.txt @@ -0,0 +1,23 @@ +JetFile: noParameterYet.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Deprecated') + PsiErrorElement:Parameter name expected + + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt index bb6ddddc778..1469ffe7d5a 100644 --- a/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt +++ b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt @@ -137,12 +137,19 @@ JetFile: targetExpected.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST - PsiErrorElement:Expected annotation identifier after ':' + ANNOTATION_ENTRY PsiElement(AT)('@') - PsiElement(IDENTIFIER)('fiield') + PsiErrorElement:Expected annotation target before ':' + PsiElement(IDENTIFIER)('fiield') PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiErrorElement:Parameter name expected + PsiElement(COLON)(':') PsiWhiteSpace(' ') TYPE_REFERENCE @@ -171,17 +178,8 @@ JetFile: targetExpected.kt PsiErrorElement:Expecting a list of annotations PsiElement(RBRACKET)(']') - PsiErrorElement:Use '@' symbol before annotations - - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiErrorElement:Parameter name expected - + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') PsiElement(COLON)(':') PsiWhiteSpace(' ') TYPE_REFERENCE diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt index 54405aefcef..263474efaef 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt @@ -288,20 +288,14 @@ JetFile: FunctionsWithFunctionReceivers.kt PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') PsiElement(fun)('fun') PsiWhiteSpace(' ') TYPE_PARAMETER_LIST @@ -434,21 +428,14 @@ JetFile: FunctionsWithFunctionReceivers.kt PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('a') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') CLASS - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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') diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt index e3d5032f24f..be0176f4b4d 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt @@ -311,62 +311,39 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiErrorElement:Use '@' symbol before annotations - - 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)('>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('T') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') PsiErrorElement:Expecting a top level declaration PsiElement(DOT)('.') PsiErrorElement:Expecting a top level declaration PsiElement(LPAR)('(') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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(IDENTIFIER)('A') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('B') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') PsiErrorElement:Expecting a top level declaration PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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 @@ -441,15 +418,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiErrorElement:Expecting a top level declaration PsiElement(LBRACKET)('[') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('a') PsiErrorElement:Expecting a top level declaration PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') @@ -457,23 +427,14 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiElement(LPAR)('(') PsiErrorElement:Expecting a top level declaration PsiElement(LPAR)('(') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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(IDENTIFIER)('A') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('B') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') PsiErrorElement:Expecting a top level declaration PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration @@ -482,20 +443,14 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration PsiElement(DOT)('.') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('foo') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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 @@ -553,29 +508,18 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('c') + PsiErrorElement:Expecting a top level declaration + PsiElement(LT)('<') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('t') + PsiErrorElement:Expecting a top level declaration + PsiElement(GT)('>') + PsiErrorElement:Expecting a top level declaration + PsiElement(DOT)('.') + PsiWhiteSpace('\n\n') CLASS - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - 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)('.') - PsiErrorElement:Expecting type name - - PsiWhiteSpace('\n\n') PsiComment(EOL_COMMENT)('//-----------') PsiWhiteSpace('\n') PsiElement(class)('class') diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt index c9f7d3d6dc4..f96a55b62b4 100644 --- a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt @@ -447,22 +447,16 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('dfget') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('dfget') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration - PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') @@ -526,22 +520,16 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('set') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('set') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration - PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt index fddd01963c3..53683a5e262 100644 --- a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt +++ b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt @@ -16,19 +16,12 @@ JetFile: functionTypes.kt PsiErrorElement:Expecting a top level declaration PsiElement(package)('package') PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('n') + PsiWhiteSpace(' ') FUN - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('n') PsiErrorElement:Expecting a top level declaration - PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt b/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt index fe87e20ba57..4bbc3e06b4f 100644 --- a/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt +++ b/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt @@ -9,14 +9,5 @@ JetFile: PackageLeadingDotDoubleID.kt IMPORT_LIST PsiWhiteSpace(' ') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') PsiErrorElement:Expecting a top level declaration - \ No newline at end of file + PsiElement(IDENTIFIER)('b') \ No newline at end of file diff --git a/compiler/testData/psi/packages/PackageLongNameDoubleID.txt b/compiler/testData/psi/packages/PackageLongNameDoubleID.txt index f24a3d902e6..885625d5d39 100644 --- a/compiler/testData/psi/packages/PackageLongNameDoubleID.txt +++ b/compiler/testData/psi/packages/PackageLongNameDoubleID.txt @@ -7,14 +7,5 @@ JetFile: PackageLongNameDoubleID.kt IMPORT_LIST PsiWhiteSpace(' ') - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') PsiErrorElement:Expecting a top level declaration - \ No newline at end of file + PsiElement(IDENTIFIER)('b') \ No newline at end of file diff --git a/compiler/testData/psi/platformTypesRecovery/FunctionsNotPlatform.txt b/compiler/testData/psi/platformTypesRecovery/FunctionsNotPlatform.txt index f417934006a..f779fab03b9 100644 --- a/compiler/testData/psi/platformTypesRecovery/FunctionsNotPlatform.txt +++ b/compiler/testData/psi/platformTypesRecovery/FunctionsNotPlatform.txt @@ -97,11 +97,10 @@ JetFile: FunctionsNotPlatform.kt VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER - MODIFIER_LIST - PsiElement(out)('out') TYPE_REFERENCE - PsiErrorElement:Type expected - + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('out') PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(ARROW)('->') @@ -145,11 +144,10 @@ JetFile: FunctionsNotPlatform.kt VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER - MODIFIER_LIST - PsiElement(out)('out') TYPE_REFERENCE - PsiErrorElement:Type expected - + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('out') PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiElement(ARROW)('->') diff --git a/compiler/testData/psi/primaryConstructor/recovery.txt b/compiler/testData/psi/primaryConstructor/recovery.txt index 6f5a136e53e..39744426c0c 100644 --- a/compiler/testData/psi/primaryConstructor/recovery.txt +++ b/compiler/testData/psi/primaryConstructor/recovery.txt @@ -82,17 +82,10 @@ JetFile: recovery.kt PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('A2') PsiWhiteSpace(' ') + PsiErrorElement:Expecting a top level declaration + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace('\n\n') CLASS - MODIFIER_LIST - PsiErrorElement:Use '@' symbol before annotations - - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Ann') - PsiWhiteSpace('\n\n') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('A3') diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java index 53f570852d2..78acac82a8e 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java @@ -819,6 +819,12 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } + @TestMetadata("noParameterYet.kt") + public void testNoParameterYet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/noParameterYet.kt"); + doParsingTest(fileName); + } + @TestMetadata("oldAnnotationsRecovery.kt") public void testOldAnnotationsRecovery() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/oldAnnotationsRecovery.kt");