diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index 947b38bfcfa..41a5c0d8759 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -462,6 +462,7 @@ public class JetParsing extends AbstractJetParsing { // modifier advanced } else if (annotationParsingMode.allowShortAnnotations && at(IDENTIFIER)) { + error("Use '@' symbol before annotations"); parseAnnotation(annotationParsingMode); } else { @@ -532,11 +533,11 @@ public class JetParsing extends AbstractJetParsing { /* * annotation - * : annotationPrefix? unescapedAnnotation + * : "@" (annotationUseSiteTarget ":")? unescapedAnnotation * ; * * annotationList - * : annotationPrefix "[" unescapedAnnotation+ "]" + * : "@" (annotationUseSiteTarget ":")? "[" unescapedAnnotation+ "]" * ; * * annotationUseSiteTarget @@ -548,10 +549,6 @@ public class JetParsing extends AbstractJetParsing { * : "param" * : "sparam" * ; - * - * annotationPrefix: - * : ("@" (annotationUseSiteTarget ":")?) - * ; */ private boolean parseAnnotationOrList(AnnotationParsingMode mode) { if (at(AT)) { @@ -697,7 +694,7 @@ public class JetParsing extends AbstractJetParsing { /* * annotation - * : annotationPrefix? unescapedAnnotation + * : "@" (annotationUseSiteTarget ":")? unescapedAnnotation * ; * * unescapedAnnotation diff --git a/compiler/testData/psi/DynamicSoftKeyword.txt b/compiler/testData/psi/DynamicSoftKeyword.txt index 84057a7ce69..caab8a03a00 100644 --- a/compiler/testData/psi/DynamicSoftKeyword.txt +++ b/compiler/testData/psi/DynamicSoftKeyword.txt @@ -5,6 +5,8 @@ JetFile: DynamicSoftKeyword.kt CLASS MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/EnumOldConstructorSyntax.txt b/compiler/testData/psi/EnumOldConstructorSyntax.txt index d63567a571f..995ce0d1562 100644 --- a/compiler/testData/psi/EnumOldConstructorSyntax.txt +++ b/compiler/testData/psi/EnumOldConstructorSyntax.txt @@ -36,6 +36,8 @@ JetFile: EnumOldConstructorSyntax.kt PsiWhiteSpace(' ') PROPERTY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/EnumWithAnnotationKeyword.txt b/compiler/testData/psi/EnumWithAnnotationKeyword.txt index 5bfc06139f0..ae12b5688b2 100644 --- a/compiler/testData/psi/EnumWithAnnotationKeyword.txt +++ b/compiler/testData/psi/EnumWithAnnotationKeyword.txt @@ -29,6 +29,8 @@ JetFile: EnumWithAnnotationKeyword.kt PsiElement(enum)('enum') PsiWhiteSpace(' ') PsiElement(annotation)('annotation') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/FileStart_ERR.txt b/compiler/testData/psi/FileStart_ERR.txt index 2cc2fa41a32..94bb0be977d 100644 --- a/compiler/testData/psi/FileStart_ERR.txt +++ b/compiler/testData/psi/FileStart_ERR.txt @@ -9,6 +9,8 @@ JetFile: FileStart_ERR.kt PsiElement(package)('package') PsiWhiteSpace(' ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -19,6 +21,8 @@ JetFile: FileStart_ERR.kt PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -26,6 +30,8 @@ JetFile: FileStart_ERR.kt USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('import') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/InterfaceWithEnumKeyword.txt b/compiler/testData/psi/InterfaceWithEnumKeyword.txt index a7700037e02..05040faf6c6 100644 --- a/compiler/testData/psi/InterfaceWithEnumKeyword.txt +++ b/compiler/testData/psi/InterfaceWithEnumKeyword.txt @@ -20,6 +20,8 @@ JetFile: InterfaceWithEnumKeyword.kt PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -45,6 +47,8 @@ JetFile: InterfaceWithEnumKeyword.kt PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/NonTypeBeforeDotInBaseClass.txt b/compiler/testData/psi/NonTypeBeforeDotInBaseClass.txt index 8ddf2504a93..20db7e7c838 100644 --- a/compiler/testData/psi/NonTypeBeforeDotInBaseClass.txt +++ b/compiler/testData/psi/NonTypeBeforeDotInBaseClass.txt @@ -30,6 +30,8 @@ JetFile: NonTypeBeforeDotInBaseClass.kt PsiElement(DOT)('.') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/ParameterNameMising.txt b/compiler/testData/psi/ParameterNameMising.txt index ff90e8b39c4..ab75fd2f2ed 100644 --- a/compiler/testData/psi/ParameterNameMising.txt +++ b/compiler/testData/psi/ParameterNameMising.txt @@ -73,6 +73,8 @@ JetFile: ParameterNameMising.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/ParameterType.kt b/compiler/testData/psi/ParameterType.kt index dc873605dde..d4eeb407dc6 100644 --- a/compiler/testData/psi/ParameterType.kt +++ b/compiler/testData/psi/ParameterType.kt @@ -2,8 +2,8 @@ fun test1(a) {} fun test2(a = 4) {} fun test3(c: Int) {} -fun test4(ann(parameter) a) {} -fun test5(ann a) {} +fun test4(@ann(parameter) a) {} +fun test5(@ann a) {} fun test() { try { diff --git a/compiler/testData/psi/ParameterType.txt b/compiler/testData/psi/ParameterType.txt index 073a44c0b61..fd9a0798bbc 100644 --- a/compiler/testData/psi/ParameterType.txt +++ b/compiler/testData/psi/ParameterType.txt @@ -65,6 +65,7 @@ JetFile: ParameterType.kt VALUE_PARAMETER MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -93,6 +94,7 @@ JetFile: ParameterType.kt VALUE_PARAMETER MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/ParameterType_ERR.txt b/compiler/testData/psi/ParameterType_ERR.txt index b564ed7ccca..78bc263d4e2 100644 --- a/compiler/testData/psi/ParameterType_ERR.txt +++ b/compiler/testData/psi/ParameterType_ERR.txt @@ -34,6 +34,8 @@ JetFile: ParameterType_ERR.kt PsiErrorElement:Expecting ')' PsiElement(LPAR)('(') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -66,6 +68,8 @@ JetFile: ParameterType_ERR.kt PsiErrorElement:Expecting ')' PsiElement(LPAR)('(') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -228,4 +232,4 @@ JetFile: ParameterType_ERR.kt TYPE_REFERENCE PsiErrorElement:Type expected - PsiElement(RPAR)(')') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/Properties_ERR.txt b/compiler/testData/psi/Properties_ERR.txt index 8160c281c03..8e4a6ae3c86 100644 --- a/compiler/testData/psi/Properties_ERR.txt +++ b/compiler/testData/psi/Properties_ERR.txt @@ -187,6 +187,8 @@ JetFile: Properties_ERR.kt PsiWhiteSpace(' ') PROPERTY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -226,4 +228,4 @@ JetFile: Properties_ERR.kt PsiWhiteSpace(' ') PsiErrorElement:Property getter or setter expected - PsiElement(MINUS)('-') + PsiElement(MINUS)('-') \ No newline at end of file diff --git a/compiler/testData/psi/RootPackage.txt b/compiler/testData/psi/RootPackage.txt index ae101516345..fa75ee9078f 100644 --- a/compiler/testData/psi/RootPackage.txt +++ b/compiler/testData/psi/RootPackage.txt @@ -22,6 +22,8 @@ JetFile: RootPackage.kt PsiWhiteSpace(' ') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/SimpleClassMembers_ERR.txt b/compiler/testData/psi/SimpleClassMembers_ERR.txt index 9e6831efab7..552fb531cdc 100644 --- a/compiler/testData/psi/SimpleClassMembers_ERR.txt +++ b/compiler/testData/psi/SimpleClassMembers_ERR.txt @@ -32,6 +32,8 @@ JetFile: SimpleClassMembers_ERR.kt PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/SimpleModifiers.txt b/compiler/testData/psi/SimpleModifiers.txt index bd4aecdfc16..ac5a881d23e 100644 --- a/compiler/testData/psi/SimpleModifiers.txt +++ b/compiler/testData/psi/SimpleModifiers.txt @@ -42,6 +42,8 @@ JetFile: SimpleModifiers.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -84,6 +86,8 @@ JetFile: SimpleModifiers.kt PsiElement(in)('in') PsiWhiteSpace('\n ') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/SoftKeywords.txt b/compiler/testData/psi/SoftKeywords.txt index 0597b55a955..bbc1598b5ac 100644 --- a/compiler/testData/psi/SoftKeywords.txt +++ b/compiler/testData/psi/SoftKeywords.txt @@ -55,6 +55,8 @@ JetFile: SoftKeywords.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/annotation/Annotations.txt b/compiler/testData/psi/annotation/Annotations.txt index 5deb5c082cb..347a7bf6d37 100644 --- a/compiler/testData/psi/annotation/Annotations.txt +++ b/compiler/testData/psi/annotation/Annotations.txt @@ -160,6 +160,8 @@ JetFile: Annotations.kt PsiElement(RBRACKET)(']') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -322,6 +324,8 @@ JetFile: Annotations.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/annotation/Annotations_ERR.txt b/compiler/testData/psi/annotation/Annotations_ERR.txt index e5821ea98c4..9d227439eb8 100644 --- a/compiler/testData/psi/annotation/Annotations_ERR.txt +++ b/compiler/testData/psi/annotation/Annotations_ERR.txt @@ -198,6 +198,8 @@ JetFile: Annotations_ERR.kt PsiElement(RBRACKET)(']') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -277,6 +279,8 @@ JetFile: Annotations_ERR.kt PsiElement(in)('in') PsiWhiteSpace('\n') PsiElement(out)('out') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace('\n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/annotation/ShortAnnotations.txt b/compiler/testData/psi/annotation/ShortAnnotations.txt index 7f64d73bf5b..0ad16a933f4 100644 --- a/compiler/testData/psi/annotation/ShortAnnotations.txt +++ b/compiler/testData/psi/annotation/ShortAnnotations.txt @@ -1,12 +1,16 @@ 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 @@ -20,6 +24,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -41,6 +47,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -58,12 +66,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n\n') 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 @@ -77,6 +89,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -98,6 +112,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -112,12 +128,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n') 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 @@ -131,6 +151,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -152,6 +174,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -167,12 +191,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n') 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 @@ -186,6 +214,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -207,6 +237,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -228,12 +260,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n') 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 @@ -247,6 +283,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -268,6 +306,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -294,12 +334,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n') 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 @@ -313,6 +357,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -334,6 +380,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -360,12 +408,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n') 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 @@ -379,6 +431,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -400,6 +454,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -429,12 +485,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -448,6 +508,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -469,6 +531,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -487,12 +551,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -506,6 +574,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -527,6 +597,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -541,12 +613,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -560,6 +636,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -581,6 +659,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -596,12 +676,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -615,6 +699,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -636,6 +722,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -657,12 +745,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -676,6 +768,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -697,6 +791,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -723,12 +819,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -742,6 +842,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -763,6 +865,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -789,12 +893,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n ') 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 @@ -808,6 +916,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -829,6 +939,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -850,12 +962,16 @@ JetFile: ShortAnnotations.kt PsiWhiteSpace('\n\n ') ANONYMOUS_INITIALIZER 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 @@ -869,6 +985,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -890,6 +1008,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -923,12 +1043,16 @@ JetFile: ShortAnnotations.kt PsiElement(LPAR)('(') 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 @@ -942,6 +1066,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -963,6 +1089,8 @@ JetFile: ShortAnnotations.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/annotation/at/declarationsJustAtTyped.kt b/compiler/testData/psi/annotation/at/declarationsJustAtTyped.kt index b273b5c5079..c8a5f75a2b6 100644 --- a/compiler/testData/psi/annotation/at/declarationsJustAtTyped.kt +++ b/compiler/testData/psi/annotation/at/declarationsJustAtTyped.kt @@ -1,4 +1,4 @@ -private @ @[Ann1(1)] Ann3("2") class A( +private @ @[Ann1(1)] @Ann3("2") class A( @ private val x: Int, @ private var y: Int, @ open z: Int diff --git a/compiler/testData/psi/annotation/at/declarationsJustAtTyped.txt b/compiler/testData/psi/annotation/at/declarationsJustAtTyped.txt index 1cadcb76834..92d23f4b57e 100644 --- a/compiler/testData/psi/annotation/at/declarationsJustAtTyped.txt +++ b/compiler/testData/psi/annotation/at/declarationsJustAtTyped.txt @@ -28,6 +28,7 @@ JetFile: declarationsJustAtTyped.kt PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/annotation/at/validDeclarations.kt b/compiler/testData/psi/annotation/at/validDeclarations.kt index ad21f6a6766..35a0702c728 100644 --- a/compiler/testData/psi/annotation/at/validDeclarations.kt +++ b/compiler/testData/psi/annotation/at/validDeclarations.kt @@ -1,4 +1,4 @@ -private @open @[Ann1(1)] @Ann2("1") Ann3("2") class A( +private @open @[Ann1(1)] @Ann2("1") @Ann3("2") class A( @Volatile(1) private val x: @AnnType("3") @open Int, @private var y: Int, @open z: Int diff --git a/compiler/testData/psi/annotation/at/validDeclarations.txt b/compiler/testData/psi/annotation/at/validDeclarations.txt index 70e07882c04..37b7607334d 100644 --- a/compiler/testData/psi/annotation/at/validDeclarations.txt +++ b/compiler/testData/psi/annotation/at/validDeclarations.txt @@ -50,6 +50,7 @@ JetFile: validDeclarations.kt PsiElement(RPAR)(')') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/annotation/forParameters.txt b/compiler/testData/psi/annotation/forParameters.txt index d025459bc3f..f1ff2dc4f10 100644 --- a/compiler/testData/psi/annotation/forParameters.txt +++ b/compiler/testData/psi/annotation/forParameters.txt @@ -78,6 +78,8 @@ JetFile: forParameters.kt PsiElement(AT)('@') PsiWhiteSpace(' ') PsiElement(in)('in') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -189,6 +191,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -221,6 +225,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -259,6 +265,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -276,6 +284,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -309,6 +319,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -323,6 +335,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -356,6 +370,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') VALUE_PARAMETER MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -390,6 +406,8 @@ JetFile: forParameters.kt PsiElement(LPAR)('(') MULTI_VARIABLE_DECLARATION MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -406,6 +424,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -440,6 +460,8 @@ JetFile: forParameters.kt VALUE_PARAMETER MODIFIER_LIST PsiElement(private)('private') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -476,6 +498,8 @@ JetFile: forParameters.kt MULTI_VARIABLE_DECLARATION MODIFIER_LIST PsiElement(private)('private') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -493,6 +517,8 @@ JetFile: forParameters.kt PsiWhiteSpace(' ') MULTI_VARIABLE_DECLARATION_ENTRY MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt index 8642fd20e75..cb2da9fa4f0 100644 --- a/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt +++ b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt @@ -58,6 +58,8 @@ JetFile: oldUsages.kt PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/annotation/options/java.kt b/compiler/testData/psi/annotation/options/java.kt index 64d86b337ca..5890b0099c1 100644 --- a/compiler/testData/psi/annotation/options/java.kt +++ b/compiler/testData/psi/annotation/options/java.kt @@ -5,6 +5,6 @@ annotation class my annotation -Retention(RetentionPolicy.RUNTIME) -Target(ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR) +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR) class my1 diff --git a/compiler/testData/psi/annotation/options/java.txt b/compiler/testData/psi/annotation/options/java.txt index a90fc1bcb8e..33b0a6efa98 100644 --- a/compiler/testData/psi/annotation/options/java.txt +++ b/compiler/testData/psi/annotation/options/java.txt @@ -61,6 +61,7 @@ JetFile: java.kt PsiElement(annotation)('annotation') PsiWhiteSpace(' \n') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -76,8 +77,9 @@ JetFile: java.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('RUNTIME') PsiElement(RPAR)(')') - PsiWhiteSpace(' \n') + PsiWhiteSpace('\n') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -102,7 +104,7 @@ JetFile: java.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('CONSTRUCTOR') PsiElement(RPAR)(')') - PsiWhiteSpace(' \n') + PsiWhiteSpace('\n') PsiElement(class)('class') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('my1') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt index 1555af1a3d0..a2cace035b2 100644 --- a/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt +++ b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt @@ -1,4 +1,4 @@ @file:foo -foo bar +@foo @bar @file: baz fun foo() {} diff --git a/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt index 3b58e690a47..88cd24293b4 100644 --- a/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt +++ b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt @@ -18,6 +18,7 @@ JetFile: withoutPackageWithSimpleAnnotation.kt FUN MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -25,6 +26,7 @@ JetFile: withoutPackageWithSimpleAnnotation.kt PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt index 0904dbf678d..bb6ddddc778 100644 --- a/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt +++ b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt @@ -171,6 +171,8 @@ JetFile: targetExpected.kt PsiErrorElement:Expecting a list of annotations PsiElement(RBRACKET)(']') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt index db8206f1833..54405aefcef 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.txt @@ -290,6 +290,8 @@ JetFile: FunctionsWithFunctionReceivers.kt PsiElement(DOT)('.') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -434,6 +436,8 @@ JetFile: FunctionsWithFunctionReceivers.kt PsiWhiteSpace('\n') CLASS MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt index b4337676616..e3d5032f24f 100644 --- a/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt +++ b/compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceiversRecovery.txt @@ -311,6 +311,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') + PsiErrorElement:Use '@' symbol before annotations + PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE @@ -331,6 +333,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiErrorElement:Expecting a top level declaration PsiElement(LPAR)('(') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -351,6 +355,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiElement(DOT)('.') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -436,6 +442,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 @@ -450,6 +458,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiErrorElement:Expecting a top level declaration PsiElement(LPAR)('(') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -474,6 +484,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiElement(DOT)('.') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -543,6 +555,8 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt PsiWhiteSpace('\n') CLASS MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt index 88cad35c81a..c9f7d3d6dc4 100644 --- a/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt +++ b/compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.txt @@ -449,6 +449,8 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiWhiteSpace('\n ') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -526,6 +528,8 @@ JetFile: PropertiesWithFunctionReceivers.kt PsiWhiteSpace('\n ') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt index 41433048b8b..fddd01963c3 100644 --- a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt +++ b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt @@ -18,6 +18,8 @@ JetFile: functionTypes.kt PsiWhiteSpace(' ') FUN MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE diff --git a/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt b/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt index b9c09229f50..fe87e20ba57 100644 --- a/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt +++ b/compiler/testData/psi/packages/PackageLeadingDotDoubleID.txt @@ -10,6 +10,8 @@ JetFile: PackageLeadingDotDoubleID.kt PsiWhiteSpace(' ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -17,4 +19,4 @@ JetFile: PackageLeadingDotDoubleID.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('b') PsiErrorElement:Expecting a top level declaration - + \ No newline at end of file diff --git a/compiler/testData/psi/packages/PackageLongNameDoubleID.txt b/compiler/testData/psi/packages/PackageLongNameDoubleID.txt index 6c7ec22fd9a..f24a3d902e6 100644 --- a/compiler/testData/psi/packages/PackageLongNameDoubleID.txt +++ b/compiler/testData/psi/packages/PackageLongNameDoubleID.txt @@ -8,6 +8,8 @@ JetFile: PackageLongNameDoubleID.kt PsiWhiteSpace(' ') MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -15,4 +17,4 @@ JetFile: PackageLongNameDoubleID.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('b') PsiErrorElement:Expecting a top level declaration - + \ No newline at end of file diff --git a/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.kt b/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.kt index de558f3bce0..6ada5de106a 100644 --- a/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.kt +++ b/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.kt @@ -1,19 +1,19 @@ class Outer1 { class Nested1 - private Ann constructor() + private @Ann constructor() } class Outer2 { class Nested2; - private Ann constructor() + private @Ann constructor() } class Outer3 { class Nested3 - private Ann constructor() : super() {} + private @Ann constructor() : super() {} } class Outer4 { diff --git a/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.txt b/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.txt index 0ceaea7d497..d9d26f2ef0e 100644 --- a/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.txt +++ b/compiler/testData/psi/primaryConstructor/nestedClassAmbiguity.txt @@ -21,6 +21,7 @@ JetFile: nestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -53,6 +54,7 @@ JetFile: nestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -87,6 +89,7 @@ JetFile: nestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/primaryConstructor/recovery.kt b/compiler/testData/psi/primaryConstructor/recovery.kt index ca24cc1681a..5ee2b350979 100644 --- a/compiler/testData/psi/primaryConstructor/recovery.kt +++ b/compiler/testData/psi/primaryConstructor/recovery.kt @@ -13,6 +13,6 @@ class A3 Ann { class A4 constructor {} class A5 constructor : Base {} -class A7 Ann(1) (x: Int) -class A8 Ann() {} -class A9 Ann() : Base() +class A7 @Ann(1) (x: Int) +class A8 @Ann() {} +class A9 @Ann() : Base() diff --git a/compiler/testData/psi/primaryConstructor/recovery.txt b/compiler/testData/psi/primaryConstructor/recovery.txt index 10be3fc00cd..4b501590c3d 100644 --- a/compiler/testData/psi/primaryConstructor/recovery.txt +++ b/compiler/testData/psi/primaryConstructor/recovery.txt @@ -57,6 +57,8 @@ JetFile: recovery.kt PsiWhiteSpace(' ') PRIMARY_CONSTRUCTOR MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -86,6 +88,8 @@ JetFile: recovery.kt PsiWhiteSpace(' ') CLASS MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -99,6 +103,8 @@ JetFile: recovery.kt PsiWhiteSpace(' ') PRIMARY_CONSTRUCTOR MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + ANNOTATION_ENTRY CONSTRUCTOR_CALLEE TYPE_REFERENCE @@ -166,6 +172,7 @@ JetFile: recovery.kt PRIMARY_CONSTRUCTOR MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -198,6 +205,7 @@ JetFile: recovery.kt PRIMARY_CONSTRUCTOR MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -221,6 +229,7 @@ JetFile: recovery.kt PRIMARY_CONSTRUCTOR MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -243,4 +252,4 @@ JetFile: recovery.kt PsiElement(IDENTIFIER)('Base') VALUE_ARGUMENT_LIST PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.kt b/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.kt index 108dc4ef9c8..ff87bff8132 100644 --- a/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.kt +++ b/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.kt @@ -1,25 +1,30 @@ class Outer1 { class Nested1 - private Ann () + private @Ann () } class Outer2 { - class Nested2 private Ann + class Nested2 private @Ann fun foo() {} } class Outer3 { - class Nested3 private Ann {} + class Nested3 private @Ann {} fun foo() } class Outer4 { - class Nested3 private Ann() {} + class Nested3 private @Ann() {} fun foo() } -class Outer4 { - class Nested3 private Ann() : Base() +class Outer5 { + class Nested3 private @Ann() : Base() fun foo() } + +class Outer6 { + class Nested1 + private Ann () +} diff --git a/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.txt b/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.txt index 75c529c4779..df7f60e0f92 100644 --- a/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.txt +++ b/compiler/testData/psi/primaryConstructor/recoveryNestedClassAmbiguity.txt @@ -20,6 +20,7 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -52,6 +53,7 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -89,6 +91,7 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -129,6 +132,7 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -157,7 +161,7 @@ JetFile: recoveryNestedClassAmbiguity.kt CLASS PsiElement(class)('class') PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Outer4') + PsiElement(IDENTIFIER)('Outer5') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') @@ -172,6 +176,7 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -205,3 +210,36 @@ JetFile: recoveryNestedClassAmbiguity.kt PsiElement(RPAR)(')') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Outer6') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Nested1') + PsiWhiteSpace('\n ') + MODIFIER_LIST + PsiElement(private)('private') + PsiErrorElement:Use '@' symbol before annotations + + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiErrorElement:Expecting member declaration + + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/primaryConstructor/valid.kt b/compiler/testData/psi/primaryConstructor/valid.kt index 3e49a64739b..01493ab73d0 100644 --- a/compiler/testData/psi/primaryConstructor/valid.kt +++ b/compiler/testData/psi/primaryConstructor/valid.kt @@ -6,8 +6,10 @@ private constructor(y: Int) : Base1(), Base2 { } class A2 @private constructor(y: Int) -class A3 Ann(1) private constructor(y: Int) +class A3 @Ann(1) private constructor(y: Int) -class A4 private Ann(1) constructor(y: Int) +class A4 private @Ann(1) constructor(y: Int) class A5 @Ann private constructor() {} + +class A6 Ann() private constructor() {} diff --git a/compiler/testData/psi/primaryConstructor/valid.txt b/compiler/testData/psi/primaryConstructor/valid.txt index cdcba67d1df..d300a41a7a7 100644 --- a/compiler/testData/psi/primaryConstructor/valid.txt +++ b/compiler/testData/psi/primaryConstructor/valid.txt @@ -112,6 +112,7 @@ JetFile: valid.kt PRIMARY_CONSTRUCTOR MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -149,6 +150,7 @@ JetFile: valid.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -199,3 +201,33 @@ JetFile: valid.kt CLASS_BODY PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A6') + PsiWhiteSpace(' ') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + PsiErrorElement:Use '@' symbol before annotations + + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(private)('private') + PsiWhiteSpace(' ') + PsiElement(constructor)('constructor') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/recovery/PackageNewLineRecovery.kt b/compiler/testData/psi/recovery/PackageNewLineRecovery.kt index d867219775f..bc3ac4f4894 100644 --- a/compiler/testData/psi/recovery/PackageNewLineRecovery.kt +++ b/compiler/testData/psi/recovery/PackageNewLineRecovery.kt @@ -1,2 +1,2 @@ package foo.bar.baz.buzz. -test val a = 12 \ No newline at end of file +@test val a = 12 \ No newline at end of file diff --git a/compiler/testData/psi/recovery/PackageNewLineRecovery.txt b/compiler/testData/psi/recovery/PackageNewLineRecovery.txt index 0059059a08c..1e7d5329509 100644 --- a/compiler/testData/psi/recovery/PackageNewLineRecovery.txt +++ b/compiler/testData/psi/recovery/PackageNewLineRecovery.txt @@ -25,6 +25,7 @@ JetFile: PackageNewLineRecovery.kt PROPERTY MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/recovery/initRecovery.kt b/compiler/testData/psi/recovery/initRecovery.kt index 49d925b28fd..04a75a1c39c 100644 --- a/compiler/testData/psi/recovery/initRecovery.kt +++ b/compiler/testData/psi/recovery/initRecovery.kt @@ -3,7 +3,7 @@ class A { } class B { - Ann init + @Ann init val x = 1 init fun foo() {} diff --git a/compiler/testData/psi/recovery/initRecovery.txt b/compiler/testData/psi/recovery/initRecovery.txt index 2f05fa8775b..77959ca0de7 100644 --- a/compiler/testData/psi/recovery/initRecovery.txt +++ b/compiler/testData/psi/recovery/initRecovery.txt @@ -29,6 +29,7 @@ JetFile: initRecovery.kt ANONYMOUS_INITIALIZER MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/secondaryConstructors/basic.kt b/compiler/testData/psi/secondaryConstructors/basic.kt index b2cf9294124..02402a62e28 100644 --- a/compiler/testData/psi/secondaryConstructors/basic.kt +++ b/compiler/testData/psi/secondaryConstructors/basic.kt @@ -3,15 +3,15 @@ class A { val x: Int - private annot constructor(x: Int) {} + private @annot constructor(x: Int) {} @constructor fun constructor() {} - annot protected constructor(x: Int, y: Int) : this(1,2) {} + @annot protected constructor(x: Int, y: Int) : this(1,2) {} @[constructor] public constructor() : super() { x = 1 } } -constructor class B +@constructor class B diff --git a/compiler/testData/psi/secondaryConstructors/basic.txt b/compiler/testData/psi/secondaryConstructors/basic.txt index 4f6117afc35..1e3dfe18451 100644 --- a/compiler/testData/psi/secondaryConstructors/basic.txt +++ b/compiler/testData/psi/secondaryConstructors/basic.txt @@ -40,6 +40,7 @@ JetFile: basic.kt PsiElement(private)('private') PsiWhiteSpace(' ') ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -90,6 +91,7 @@ JetFile: basic.kt SECONDARY_CONSTRUCTOR MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE @@ -190,6 +192,7 @@ JetFile: basic.kt CLASS MODIFIER_LIST ANNOTATION_ENTRY + PsiElement(AT)('@') CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE diff --git a/grammar/src/attributes.grm b/grammar/src/attributes.grm index 24a558a7ae9..1275096c46e 100644 --- a/grammar/src/attributes.grm +++ b/grammar/src/attributes.grm @@ -7,11 +7,11 @@ annotations ; annotation - : annotationPrefix? unescapedAnnotation + : "@" (annotationUseSiteTarget ":")? unescapedAnnotation ; annotationList - : annotationPrefix "[" unescapedAnnotation+ "]" + : "@" (annotationUseSiteTarget ":")? "[" unescapedAnnotation+ "]" ; annotationUseSiteTarget @@ -24,10 +24,6 @@ annotationUseSiteTarget : "sparam" ; -annotationPrefix: - : ("@" (annotationUseSiteTarget ":")?) - ; - unescapedAnnotation : SimpleName{"."} typeArguments? valueArguments? ; \ No newline at end of file