Parse and resolve annotations on supertypes
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ fun bar2(): Array<Q> = null!!
|
||||
val y: Array<[<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>] String?> = arrayOfNulls(1)
|
||||
val block: ([<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>] x: <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String) -> <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String = { "" }
|
||||
interface B
|
||||
interface D : [<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>] B
|
||||
interface D : <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> B
|
||||
|
||||
Ann(<!ANNOTATION_PARAMETER_MUST_BE_CONST!><!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> 1<!>) class MyClass
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
annotation class A
|
||||
|
||||
trait Foo<T : [A] Number> : [A] CharSequence {
|
||||
fun <E, F : [A] E> bar()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package test
|
||||
|
||||
internal final annotation class A : kotlin.Annotation {
|
||||
/*primary*/ public constructor A()
|
||||
}
|
||||
|
||||
internal interface Foo</*0*/ T : [test.A()] kotlin.Number> : [test.A()] kotlin.CharSequence {
|
||||
internal abstract fun </*0*/ E, /*1*/ F : [test.A()] E> 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
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
class F(a : [a] [b] B)
|
||||
|
||||
typealias f = [b] [x] F<[x] A, B>
|
||||
typealias f = [b] [x] F<[x] A, B>
|
||||
|
||||
class C : [a] B, [c d] E by F, [g] H(), [i] () -> Unit
|
||||
|
||||
@@ -95,4 +95,103 @@ JetFile: TypeAnnotations.kt
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
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')
|
||||
@@ -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");
|
||||
|
||||
+6
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user