diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index 5dc75545830..c2314d8fab7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -1472,8 +1472,6 @@ public class JetParsing extends AbstractJetParsing { } /* - * annotations delegationSpecifier - * * delegationSpecifier * : constructorInvocation // type and constructor arguments * : userType @@ -1486,8 +1484,6 @@ public class JetParsing extends AbstractJetParsing { */ private void parseDelegationSpecifier() { PsiBuilder.Marker delegator = mark(); - parseAnnotations(ONLY_ESCAPED_REGULAR_ANNOTATIONS); - PsiBuilder.Marker reference = mark(); parseTypeRef(); diff --git a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt index b3a9d8eda97..eb463662aae 100644 --- a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt +++ b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt @@ -29,6 +29,6 @@ fun bar2(): Array = null!! val y: Array<[Ann] String?> = arrayOfNulls(1) val block: ([Ann] x: [Ann] String) -> [Ann] String = { "" } interface B -interface D : [Ann] B +interface D : [Ann] B Ann([Ann] 1) class MyClass diff --git a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt index 105be364059..5e3623fb546 100644 --- a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt +++ b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt @@ -30,7 +30,7 @@ internal interface B { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -internal interface D : B { +internal interface D : [Ann()] B { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt new file mode 100644 index 00000000000..cb0257e8f99 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt @@ -0,0 +1,7 @@ +package test + +annotation class A + +trait Foo : [A] CharSequence { + fun bar() +} diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.txt b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.txt new file mode 100644 index 00000000000..0fad587d16f --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.txt @@ -0,0 +1,12 @@ +package test + +internal final annotation class A : kotlin.Annotation { + /*primary*/ public constructor A() +} + +internal interface Foo : [test.A()] kotlin.CharSequence { + internal abstract fun bar(): kotlin.Unit + public abstract override /*1*/ /*fake_override*/ fun charAt(/*0*/ index: kotlin.Int): kotlin.Char + public abstract override /*1*/ /*fake_override*/ fun length(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun subSequence(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): kotlin.CharSequence +} diff --git a/compiler/testData/psi/annotation/TypeAnnotations.kt b/compiler/testData/psi/annotation/TypeAnnotations.kt index 07d9dbcfa38..c876c590ea9 100644 --- a/compiler/testData/psi/annotation/TypeAnnotations.kt +++ b/compiler/testData/psi/annotation/TypeAnnotations.kt @@ -1,3 +1,5 @@ class F(a : [a] [b] B) -typealias f = [b] [x] F<[x] A, B> \ No newline at end of file +typealias f = [b] [x] F<[x] A, B> + +class C : [a] B, [c d] E by F, [g] H(), [i] () -> Unit diff --git a/compiler/testData/psi/annotation/TypeAnnotations.txt b/compiler/testData/psi/annotation/TypeAnnotations.txt index 0fa10279233..ff70bb2eb5b 100644 --- a/compiler/testData/psi/annotation/TypeAnnotations.txt +++ b/compiler/testData/psi/annotation/TypeAnnotations.txt @@ -95,4 +95,103 @@ JetFile: TypeAnnotations.kt USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('B') - PsiElement(GT)('>') \ No newline at end of file + PsiElement(GT)('>') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + DELEGATION_SPECIFIER_LIST + DELEGATOR_SUPER_CLASS + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_BY + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('c') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('d') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('E') + PsiWhiteSpace(' ') + PsiElement(by)('by') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('F') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CALL + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('g') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('H') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATOR_SUPER_CLASS + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java index 635a14a23ac..38318e901ed 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java @@ -2283,6 +2283,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { doTestCompiledKotlin(fileName); } + @TestMetadata("SupertypesAndBounds.kt") + public void testSupertypesAndBounds() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt"); + doTestCompiledKotlin(fileName); + } + @TestMetadata("TypeAnnotationWithArguments.kt") public void testTypeAnnotationWithArguments() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java index 1f3f100fae8..1ab40610ef3 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java @@ -440,6 +440,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD doTest(fileName); } + @TestMetadata("SupertypesAndBounds.kt") + public void testSupertypesAndBounds() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt"); + doTest(fileName); + } + @TestMetadata("TypeAnnotationWithArguments.kt") public void testTypeAnnotationWithArguments() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java index 6400a517c82..bc65a783377 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java @@ -438,6 +438,12 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest { doTest(fileName); } + @TestMetadata("SupertypesAndBounds.kt") + public void testSupertypesAndBounds() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.kt"); + doTest(fileName); + } + @TestMetadata("TypeAnnotationWithArguments.kt") public void testTypeAnnotationWithArguments() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");