Annotations on type projection belong to type reference
This commit is contained in:
@@ -455,7 +455,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
if ((annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST || annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL) &&
|
||||
atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
||||
|
||||
if (at(AT)) {
|
||||
if (at(AT) && annotationParsingMode.allowAnnotations) {
|
||||
parseAnnotationOrList(annotationParsingMode);
|
||||
}
|
||||
else if (tryParseModifier(tokenConsumer)) {
|
||||
@@ -2082,7 +2082,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
// TokenSet stopAt = TokenSet.create(COMMA, COLON, GT);
|
||||
// parseModifierListWithUnescapedAnnotations(MODIFIER_LIST, lookFor, stopAt);
|
||||
// Currently we do not allow annotations
|
||||
parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
parseModifierList(NO_ANNOTATIONS);
|
||||
|
||||
if (at(MUL)) {
|
||||
advance(); // MUL
|
||||
@@ -2331,26 +2331,31 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
enum AnnotationParsingMode {
|
||||
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false),
|
||||
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false),
|
||||
ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false),
|
||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false),
|
||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true),
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false),
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL(false, false, false);
|
||||
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false, true),
|
||||
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false, true),
|
||||
ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false, true),
|
||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false, true),
|
||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true, true),
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false, true),
|
||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL(false, false, false, true),
|
||||
NO_ANNOTATIONS(false, false, false, false);
|
||||
|
||||
|
||||
boolean allowShortAnnotations;
|
||||
boolean isFileAnnotationParsingMode;
|
||||
boolean atMemberStart;
|
||||
boolean allowAnnotations;
|
||||
|
||||
AnnotationParsingMode(
|
||||
boolean allowShortAnnotations,
|
||||
boolean isFileAnnotationParsingMode,
|
||||
boolean atMemberStart
|
||||
boolean atMemberStart,
|
||||
boolean allowAnnotations
|
||||
) {
|
||||
this.allowShortAnnotations = allowShortAnnotations;
|
||||
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
|
||||
this.atMemberStart = atMemberStart;
|
||||
this.allowAnnotations = allowAnnotations;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
annotation class base
|
||||
|
||||
val x: List<@<!DEBUG_INFO_MISSING_UNRESOLVED!>base<!> String>? = null
|
||||
val x: List<@base String>? = null
|
||||
|
||||
val y: List<@[base] String>? = null
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package
|
||||
|
||||
public val x: kotlin.List<kotlin.String>? = null
|
||||
public val x: kotlin.List<@base() kotlin.String>? = null
|
||||
public val y: kotlin.List<@base() kotlin.String>? = null
|
||||
|
||||
@kotlin.annotation.annotation() public final class base : kotlin.Annotation {
|
||||
public constructor base()
|
||||
|
||||
+2
-3
@@ -79,7 +79,7 @@ JetFile: TypeAnnotations.kt
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
MODIFIER_LIST
|
||||
TYPE_REFERENCE
|
||||
ANNOTATION
|
||||
PsiElement(AT)('@')
|
||||
PsiElement(LBRACKET)('[')
|
||||
@@ -90,8 +90,7 @@ JetFile: TypeAnnotations.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
|
||||
@@ -10,7 +10,7 @@ public final class FunctionTypes public constructor() {
|
||||
|
||||
public final fun f3(f: kotlin.Int.(kotlin.Int) -> kotlin.Unit): kotlin.Unit { /* compiled code */ }
|
||||
|
||||
public final fun f4(f: kotlin.List<kotlin.Function1<*, *>>): kotlin.Unit { /* compiled code */ }
|
||||
public final fun f4(f: kotlin.List<@kotlin.Extension kotlin.Function1<*, *>>): kotlin.Unit { /* compiled code */ }
|
||||
|
||||
public final fun <A> (A.(A) -> A)?.bar(): kotlin.Unit { /* compiled code */ }
|
||||
|
||||
|
||||
@@ -252,6 +252,13 @@ PsiJetFileStubImpl[package=test]
|
||||
TYPE_ARGUMENT_LIST:
|
||||
TYPE_PROJECTION:[projectionKind=NONE]
|
||||
TYPE_REFERENCE:
|
||||
ANNOTATION_ENTRY:[hasValueArguments=false, shortName=Extension]
|
||||
CONSTRUCTOR_CALLEE:
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION:[referencedName=Extension]
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
||||
|
||||
Reference in New Issue
Block a user