From a1eb544807efff8dd68cb482d6c7090d5ef8b8f1 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Fri, 17 Jul 2015 19:07:24 +0300 Subject: [PATCH] Parser tests for targeted annotations --- .../psi/annotation/targeted/onField/fqName.kt | 6 + .../annotation/targeted/onField/fqName.txt | 43 +++ .../targeted/onField/inWrongPlace.kt | 13 + .../targeted/onField/inWrongPlace.txt | 85 ++++++ .../onField/manyInOneAnnotationBlock.kt | 6 + .../onField/manyInOneAnnotationBlock.txt | 56 ++++ .../targeted/onField/simpleFieldAnnotation.kt | 6 + .../onField/simpleFieldAnnotation.txt | 39 +++ .../onFile/fileAnnotationInWrongPlace.kt | 0 .../onFile/fileAnnotationInWrongPlace.txt | 0 .../onFile/manyAnnotationBlocks.kt | 0 .../onFile/manyAnnotationBlocks.txt | 0 .../onFile/manyInOneAnnotationBlock.kt | 0 .../onFile/manyInOneAnnotationBlock.txt | 0 .../onFile/nonFIleAnnotationBeforePackage.kt | 0 .../onFile/nonFIleAnnotationBeforePackage.txt | 0 .../{ => targeted}/onFile/single.kt | 0 .../{ => targeted}/onFile/single.txt | 0 ...houtFileAnnotationAndPackageDeclaration.kt | 0 ...outFileAnnotationAndPackageDeclaration.txt | 0 .../{ => targeted}/onFile/withoutPackage.kt | 0 .../{ => targeted}/onFile/withoutPackage.txt | 0 .../withoutPackageWithSimpleAnnotation.kt | 0 .../withoutPackageWithSimpleAnnotation.txt | 0 .../targeted/onGetSetSparam/inWrongPlace.kt | 28 ++ .../targeted/onGetSetSparam/inWrongPlace.txt | 237 ++++++++++++++++ .../targeted/onGetSetSparam/simple.kt | 8 + .../targeted/onGetSetSparam/simple.txt | 67 +++++ .../onGetSetSparam/twoAnnotationLists.kt | 10 + .../onGetSetSparam/twoAnnotationLists.txt | 126 +++++++++ .../annotation/targeted/onParam/modifiers.kt | 1 + .../annotation/targeted/onParam/modifiers.txt | 56 ++++ .../annotation/targeted/onParam/recovery.kt | 1 + .../annotation/targeted/onParam/recovery.txt | 36 +++ .../psi/annotation/targeted/onParam/simple.kt | 3 + .../annotation/targeted/onParam/simple.txt | 80 ++++++ .../targeted/onParam/targetExpected.kt | 13 + .../targeted/onParam/targetExpected.txt | 259 ++++++++++++++++++ .../parsing/JetParsingTestGenerated.java | 216 +++++++++++---- 39 files changed, 1338 insertions(+), 57 deletions(-) create mode 100644 compiler/testData/psi/annotation/targeted/onField/fqName.kt create mode 100644 compiler/testData/psi/annotation/targeted/onField/fqName.txt create mode 100644 compiler/testData/psi/annotation/targeted/onField/inWrongPlace.kt create mode 100644 compiler/testData/psi/annotation/targeted/onField/inWrongPlace.txt create mode 100644 compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.kt create mode 100644 compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.txt create mode 100644 compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.kt create mode 100644 compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.txt rename compiler/testData/psi/annotation/{ => targeted}/onFile/fileAnnotationInWrongPlace.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/fileAnnotationInWrongPlace.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/manyAnnotationBlocks.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/manyAnnotationBlocks.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/manyInOneAnnotationBlock.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/manyInOneAnnotationBlock.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/nonFIleAnnotationBeforePackage.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/nonFIleAnnotationBeforePackage.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/single.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/single.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutFileAnnotationAndPackageDeclaration.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutFileAnnotationAndPackageDeclaration.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutPackage.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutPackage.txt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutPackageWithSimpleAnnotation.kt (100%) rename compiler/testData/psi/annotation/{ => targeted}/onFile/withoutPackageWithSimpleAnnotation.txt (100%) create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.kt create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.txt create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.kt create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.txt create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.kt create mode 100644 compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.txt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/modifiers.kt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/modifiers.txt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/recovery.kt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/recovery.txt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/simple.kt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/simple.txt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/targetExpected.kt create mode 100644 compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt diff --git a/compiler/testData/psi/annotation/targeted/onField/fqName.kt b/compiler/testData/psi/annotation/targeted/onField/fqName.kt new file mode 100644 index 00000000000..cd23f6e0be7 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/fqName.kt @@ -0,0 +1,6 @@ +class A { + + @field:kotlin.deprecated + val a = "String" + +} \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/fqName.txt b/compiler/testData/psi/annotation/targeted/onField/fqName.txt new file mode 100644 index 00000000000..4c19df30907 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/fqName.txt @@ -0,0 +1,43 @@ +JetFile: fqName.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('kotlin') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + LITERAL_STRING_TEMPLATE_ENTRY + PsiElement(REGULAR_STRING_PART)('String') + PsiElement(CLOSING_QUOTE)('"') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.kt b/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.kt new file mode 100644 index 00000000000..ac87753eac0 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.kt @@ -0,0 +1,13 @@ +@field:deprecated + +@field:deprecated +package boo + +@field:deprecated +class A + +@field:deprecated +interface I + +@field:deprecated +fun a() \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.txt b/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.txt new file mode 100644 index 00000000000..7bd53020b05 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/inWrongPlace.txt @@ -0,0 +1,85 @@ +JetFile: inWrongPlace.kt + FILE_ANNOTATION_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PACKAGE_DIRECTIVE + PsiElement(package)('package') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('boo') + IMPORT_LIST + + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('I') + PsiWhiteSpace('\n\n') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.kt b/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.kt new file mode 100644 index 00000000000..697a2a28c05 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.kt @@ -0,0 +1,6 @@ +class A { + + @field:[first second third] + val a = "String" + +} \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.txt b/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.txt new file mode 100644 index 00000000000..5d010911d9a --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.txt @@ -0,0 +1,56 @@ +JetFile: manyInOneAnnotationBlock.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('first') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('second') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('third') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + LITERAL_STRING_TEMPLATE_ENTRY + PsiElement(REGULAR_STRING_PART)('String') + PsiElement(CLOSING_QUOTE)('"') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.kt b/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.kt new file mode 100644 index 00000000000..0e4d1f47016 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.kt @@ -0,0 +1,6 @@ +class A { + + @field:deprecated + val a = "String" + +} \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.txt b/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.txt new file mode 100644 index 00000000000..d22838a6c86 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.txt @@ -0,0 +1,39 @@ +JetFile: simpleFieldAnnotation.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + LITERAL_STRING_TEMPLATE_ENTRY + PsiElement(REGULAR_STRING_PART)('String') + PsiElement(CLOSING_QUOTE)('"') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.kt b/compiler/testData/psi/annotation/targeted/onFile/fileAnnotationInWrongPlace.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.kt rename to compiler/testData/psi/annotation/targeted/onFile/fileAnnotationInWrongPlace.kt diff --git a/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt b/compiler/testData/psi/annotation/targeted/onFile/fileAnnotationInWrongPlace.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt rename to compiler/testData/psi/annotation/targeted/onFile/fileAnnotationInWrongPlace.txt diff --git a/compiler/testData/psi/annotation/onFile/manyAnnotationBlocks.kt b/compiler/testData/psi/annotation/targeted/onFile/manyAnnotationBlocks.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/manyAnnotationBlocks.kt rename to compiler/testData/psi/annotation/targeted/onFile/manyAnnotationBlocks.kt diff --git a/compiler/testData/psi/annotation/onFile/manyAnnotationBlocks.txt b/compiler/testData/psi/annotation/targeted/onFile/manyAnnotationBlocks.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/manyAnnotationBlocks.txt rename to compiler/testData/psi/annotation/targeted/onFile/manyAnnotationBlocks.txt diff --git a/compiler/testData/psi/annotation/onFile/manyInOneAnnotationBlock.kt b/compiler/testData/psi/annotation/targeted/onFile/manyInOneAnnotationBlock.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/manyInOneAnnotationBlock.kt rename to compiler/testData/psi/annotation/targeted/onFile/manyInOneAnnotationBlock.kt diff --git a/compiler/testData/psi/annotation/onFile/manyInOneAnnotationBlock.txt b/compiler/testData/psi/annotation/targeted/onFile/manyInOneAnnotationBlock.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/manyInOneAnnotationBlock.txt rename to compiler/testData/psi/annotation/targeted/onFile/manyInOneAnnotationBlock.txt diff --git a/compiler/testData/psi/annotation/onFile/nonFIleAnnotationBeforePackage.kt b/compiler/testData/psi/annotation/targeted/onFile/nonFIleAnnotationBeforePackage.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/nonFIleAnnotationBeforePackage.kt rename to compiler/testData/psi/annotation/targeted/onFile/nonFIleAnnotationBeforePackage.kt diff --git a/compiler/testData/psi/annotation/onFile/nonFIleAnnotationBeforePackage.txt b/compiler/testData/psi/annotation/targeted/onFile/nonFIleAnnotationBeforePackage.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/nonFIleAnnotationBeforePackage.txt rename to compiler/testData/psi/annotation/targeted/onFile/nonFIleAnnotationBeforePackage.txt diff --git a/compiler/testData/psi/annotation/onFile/single.kt b/compiler/testData/psi/annotation/targeted/onFile/single.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/single.kt rename to compiler/testData/psi/annotation/targeted/onFile/single.kt diff --git a/compiler/testData/psi/annotation/onFile/single.txt b/compiler/testData/psi/annotation/targeted/onFile/single.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/single.txt rename to compiler/testData/psi/annotation/targeted/onFile/single.txt diff --git a/compiler/testData/psi/annotation/onFile/withoutFileAnnotationAndPackageDeclaration.kt b/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutFileAnnotationAndPackageDeclaration.kt rename to compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.kt diff --git a/compiler/testData/psi/annotation/onFile/withoutFileAnnotationAndPackageDeclaration.txt b/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutFileAnnotationAndPackageDeclaration.txt rename to compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt diff --git a/compiler/testData/psi/annotation/onFile/withoutPackage.kt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackage.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutPackage.kt rename to compiler/testData/psi/annotation/targeted/onFile/withoutPackage.kt diff --git a/compiler/testData/psi/annotation/onFile/withoutPackage.txt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackage.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutPackage.txt rename to compiler/testData/psi/annotation/targeted/onFile/withoutPackage.txt diff --git a/compiler/testData/psi/annotation/onFile/withoutPackageWithSimpleAnnotation.kt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutPackageWithSimpleAnnotation.kt rename to compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt diff --git a/compiler/testData/psi/annotation/onFile/withoutPackageWithSimpleAnnotation.txt b/compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt similarity index 100% rename from compiler/testData/psi/annotation/onFile/withoutPackageWithSimpleAnnotation.txt rename to compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.txt diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.kt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.kt new file mode 100644 index 00000000000..cf824b4e037 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.kt @@ -0,0 +1,28 @@ +@get:deprecated +@set:deprecated +@sparam:deprecated + +@get:deprecated +@set:deprecated +@sparam:deprecated +package boo + +@get:deprecated +@set:deprecated +@sparam:deprecated +class A + +@get:deprecated +@set:deprecated +@sparam:deprecated +interface I + +@get:deprecated +@set:deprecated +@sparam:deprecated +fun a() + +@get:deprecated +@set:deprecated +@sparam:deprecated +fun b() \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.txt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.txt new file mode 100644 index 00000000000..ae866640308 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.txt @@ -0,0 +1,237 @@ +JetFile: inWrongPlace.kt + FILE_ANNOTATION_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PACKAGE_DIRECTIVE + PsiElement(package)('package') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('boo') + IMPORT_LIST + + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('I') + PsiWhiteSpace('\n\n') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('deprecated') + PsiWhiteSpace('\n') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.kt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.kt new file mode 100644 index 00000000000..e34a7ed3f9e --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.kt @@ -0,0 +1,8 @@ +class A { + + @get:An + @set:An + @sparam:An + var a: String = "A" + +} \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.txt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.txt new file mode 100644 index 00000000000..c61ba8bf429 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.txt @@ -0,0 +1,67 @@ +JetFile: simple.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('An') + PsiWhiteSpace('\n ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('An') + PsiWhiteSpace('\n ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('An') + PsiWhiteSpace('\n ') + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + STRING_TEMPLATE + PsiElement(OPEN_QUOTE)('"') + LITERAL_STRING_TEMPLATE_ENTRY + PsiElement(REGULAR_STRING_PART)('A') + PsiElement(CLOSING_QUOTE)('"') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.kt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.kt new file mode 100644 index 00000000000..9e6548d61a0 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.kt @@ -0,0 +1,10 @@ +class A { + + @get:a + @set:[b c] + @sparam:d + var a: Int + @e get() = 5 + @f @g set(@h v) {} + +} \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.txt b/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.txt new file mode 100644 index 00000000000..4c0cb988737 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.txt @@ -0,0 +1,126 @@ +JetFile: twoAnnotationLists.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(get)('get') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n ') + ANNOTATION + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(set)('set') + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('c') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(sparam)('sparam') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('d') + PsiWhiteSpace('\n ') + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('5') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('g') + PsiWhiteSpace(' ') + PsiElement(set)('set') + PsiElement(LPAR)('(') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('h') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('v') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/modifiers.kt b/compiler/testData/psi/annotation/targeted/onParam/modifiers.kt new file mode 100644 index 00000000000..90044e12f2a --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/modifiers.kt @@ -0,0 +1 @@ +public class A(public @param:Ann private @param:[Ann] val value: String) \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/modifiers.txt b/compiler/testData/psi/annotation/targeted/onParam/modifiers.txt new file mode 100644 index 00000000000..af6feb1fade --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/modifiers.txt @@ -0,0 +1,56 @@ +JetFile: modifiers.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + PsiElement(private)('private') + PsiWhiteSpace(' ') + ANNOTATION + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('value') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/recovery.kt b/compiler/testData/psi/annotation/targeted/onParam/recovery.kt new file mode 100644 index 00000000000..c91a0e56ba6 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/recovery.kt @@ -0,0 +1 @@ +public class A @param:Ann : B \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/recovery.txt b/compiler/testData/psi/annotation/targeted/onParam/recovery.txt new file mode 100644 index 00000000000..e71b1dd22d9 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/recovery.txt @@ -0,0 +1,36 @@ +JetFile: recovery.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + PRIMARY_CONSTRUCTOR + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiErrorElement:Expecting 'constructor' keyword + + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + DELEGATION_SPECIFIER_LIST + DELEGATOR_SUPER_CLASS + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/simple.kt b/compiler/testData/psi/annotation/targeted/onParam/simple.kt new file mode 100644 index 00000000000..c8836bddb66 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/simple.kt @@ -0,0 +1,3 @@ +public class A(@param:Ann value: String) + +public class B(@param:[Ann Ann2] val n: Int) \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/simple.txt b/compiler/testData/psi/annotation/targeted/onParam/simple.txt new file mode 100644 index 00000000000..067bbdbd092 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/simple.txt @@ -0,0 +1,80 @@ +JetFile: simple.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('value') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('B') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann2') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('n') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onParam/targetExpected.kt b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.kt new file mode 100644 index 00000000000..d54a810fa94 --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.kt @@ -0,0 +1,13 @@ +public class A(@:Ann val a: String, @:[Ann] public val b: Int) + +public class B(@param: val a: String) + +public class C(@param:[] val a: String) + +public class D(@fiield: a: Int) + +public class E(@:[] a: Int) + +public class F(@field: @field:Ann a: Int) + +public class G(@field: Ann a: Int) \ 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 new file mode 100644 index 00000000000..0904dbf678d --- /dev/null +++ b/compiler/testData/psi/annotation/targeted/onParam/targetExpected.txt @@ -0,0 +1,259 @@ +JetFile: targetExpected.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + PsiErrorElement:Expected annotation target before ':' + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + PsiErrorElement:Expected annotation target before ':' + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('b') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('B') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + PsiErrorElement:Expected annotation identifier after ':' + PsiElement(AT)('@') + PsiElement(IDENTIFIER)('param') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('C') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(param)('param') + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + PsiErrorElement:Expecting a list of annotations + + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('D') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + PsiErrorElement:Expected annotation identifier after ':' + PsiElement(AT)('@') + PsiElement(IDENTIFIER)('fiield') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('E') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + PsiErrorElement:Expected annotation target before ':' + PsiElement(COLON)(':') + PsiElement(LBRACKET)('[') + PsiErrorElement:Expecting a list of annotations + + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiErrorElement:Parameter name expected + + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('F') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + PsiErrorElement:Expected annotation identifier after ':' + PsiElement(AT)('@') + PsiElement(IDENTIFIER)('field') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('G') + PRIMARY_CONSTRUCTOR + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + ANNOTATION_TARGET + PsiElement(field)('field') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Ann') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java index 0f348603fe2..099cf41a833 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java @@ -891,63 +891,6 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { } } - @TestMetadata("compiler/testData/psi/annotation/onFile") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class OnFile extends AbstractJetParsingTest { - public void testAllFilesPresentInOnFile() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/onFile"), Pattern.compile("^(.*)\\.kts?$"), true); - } - - @TestMetadata("fileAnnotationInWrongPlace.kt") - public void testFileAnnotationInWrongPlace() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.kt"); - doParsingTest(fileName); - } - - @TestMetadata("manyAnnotationBlocks.kt") - public void testManyAnnotationBlocks() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/manyAnnotationBlocks.kt"); - doParsingTest(fileName); - } - - @TestMetadata("manyInOneAnnotationBlock.kt") - public void testManyInOneAnnotationBlock() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/manyInOneAnnotationBlock.kt"); - doParsingTest(fileName); - } - - @TestMetadata("nonFIleAnnotationBeforePackage.kt") - public void testNonFIleAnnotationBeforePackage() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/nonFIleAnnotationBeforePackage.kt"); - doParsingTest(fileName); - } - - @TestMetadata("single.kt") - public void testSingle() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/single.kt"); - doParsingTest(fileName); - } - - @TestMetadata("withoutFileAnnotationAndPackageDeclaration.kt") - public void testWithoutFileAnnotationAndPackageDeclaration() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/withoutFileAnnotationAndPackageDeclaration.kt"); - doParsingTest(fileName); - } - - @TestMetadata("withoutPackage.kt") - public void testWithoutPackage() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/withoutPackage.kt"); - doParsingTest(fileName); - } - - @TestMetadata("withoutPackageWithSimpleAnnotation.kt") - public void testWithoutPackageWithSimpleAnnotation() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/onFile/withoutPackageWithSimpleAnnotation.kt"); - doParsingTest(fileName); - } - } - @TestMetadata("compiler/testData/psi/annotation/options") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -998,6 +941,165 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } } + + @TestMetadata("compiler/testData/psi/annotation/targeted") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Targeted extends AbstractJetParsingTest { + public void testAllFilesPresentInTargeted() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/targeted"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("compiler/testData/psi/annotation/targeted/onField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class OnField extends AbstractJetParsingTest { + public void testAllFilesPresentInOnField() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/targeted/onField"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("fqName.kt") + public void testFqName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onField/fqName.kt"); + doParsingTest(fileName); + } + + @TestMetadata("inWrongPlace.kt") + public void testInWrongPlace() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onField/inWrongPlace.kt"); + doParsingTest(fileName); + } + + @TestMetadata("manyInOneAnnotationBlock.kt") + public void testManyInOneAnnotationBlock() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onField/manyInOneAnnotationBlock.kt"); + doParsingTest(fileName); + } + + @TestMetadata("simpleFieldAnnotation.kt") + public void testSimpleFieldAnnotation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onField/simpleFieldAnnotation.kt"); + doParsingTest(fileName); + } + } + + @TestMetadata("compiler/testData/psi/annotation/targeted/onFile") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class OnFile extends AbstractJetParsingTest { + public void testAllFilesPresentInOnFile() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/targeted/onFile"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("fileAnnotationInWrongPlace.kt") + public void testFileAnnotationInWrongPlace() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/fileAnnotationInWrongPlace.kt"); + doParsingTest(fileName); + } + + @TestMetadata("manyAnnotationBlocks.kt") + public void testManyAnnotationBlocks() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/manyAnnotationBlocks.kt"); + doParsingTest(fileName); + } + + @TestMetadata("manyInOneAnnotationBlock.kt") + public void testManyInOneAnnotationBlock() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/manyInOneAnnotationBlock.kt"); + doParsingTest(fileName); + } + + @TestMetadata("nonFIleAnnotationBeforePackage.kt") + public void testNonFIleAnnotationBeforePackage() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/nonFIleAnnotationBeforePackage.kt"); + doParsingTest(fileName); + } + + @TestMetadata("single.kt") + public void testSingle() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/single.kt"); + doParsingTest(fileName); + } + + @TestMetadata("withoutFileAnnotationAndPackageDeclaration.kt") + public void testWithoutFileAnnotationAndPackageDeclaration() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.kt"); + doParsingTest(fileName); + } + + @TestMetadata("withoutPackage.kt") + public void testWithoutPackage() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/withoutPackage.kt"); + doParsingTest(fileName); + } + + @TestMetadata("withoutPackageWithSimpleAnnotation.kt") + public void testWithoutPackageWithSimpleAnnotation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onFile/withoutPackageWithSimpleAnnotation.kt"); + doParsingTest(fileName); + } + } + + @TestMetadata("compiler/testData/psi/annotation/targeted/onGetSetSparam") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class OnGetSetSparam extends AbstractJetParsingTest { + public void testAllFilesPresentInOnGetSetSparam() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/targeted/onGetSetSparam"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("inWrongPlace.kt") + public void testInWrongPlace() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onGetSetSparam/inWrongPlace.kt"); + doParsingTest(fileName); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onGetSetSparam/simple.kt"); + doParsingTest(fileName); + } + + @TestMetadata("twoAnnotationLists.kt") + public void testTwoAnnotationLists() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onGetSetSparam/twoAnnotationLists.kt"); + doParsingTest(fileName); + } + } + + @TestMetadata("compiler/testData/psi/annotation/targeted/onParam") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class OnParam extends AbstractJetParsingTest { + public void testAllFilesPresentInOnParam() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/targeted/onParam"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("modifiers.kt") + public void testModifiers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onParam/modifiers.kt"); + doParsingTest(fileName); + } + + @TestMetadata("recovery.kt") + public void testRecovery() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onParam/recovery.kt"); + doParsingTest(fileName); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onParam/simple.kt"); + doParsingTest(fileName); + } + + @TestMetadata("targetExpected.kt") + public void testTargetExpected() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/targeted/onParam/targetExpected.kt"); + doParsingTest(fileName); + } + } + } } @TestMetadata("compiler/testData/psi/examples")