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) &&
|
if ((annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST || annotationParsingMode == PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL) &&
|
||||||
atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
atSet(CONSTRUCTOR_KEYWORD, WHERE_KEYWORD)) break;
|
||||||
|
|
||||||
if (at(AT)) {
|
if (at(AT) && annotationParsingMode.allowAnnotations) {
|
||||||
parseAnnotationOrList(annotationParsingMode);
|
parseAnnotationOrList(annotationParsingMode);
|
||||||
}
|
}
|
||||||
else if (tryParseModifier(tokenConsumer)) {
|
else if (tryParseModifier(tokenConsumer)) {
|
||||||
@@ -2082,7 +2082,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
// TokenSet stopAt = TokenSet.create(COMMA, COLON, GT);
|
// TokenSet stopAt = TokenSet.create(COMMA, COLON, GT);
|
||||||
// parseModifierListWithUnescapedAnnotations(MODIFIER_LIST, lookFor, stopAt);
|
// parseModifierListWithUnescapedAnnotations(MODIFIER_LIST, lookFor, stopAt);
|
||||||
// Currently we do not allow annotations
|
// Currently we do not allow annotations
|
||||||
parseModifierList(ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
parseModifierList(NO_ANNOTATIONS);
|
||||||
|
|
||||||
if (at(MUL)) {
|
if (at(MUL)) {
|
||||||
advance(); // MUL
|
advance(); // MUL
|
||||||
@@ -2331,26 +2331,31 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum AnnotationParsingMode {
|
enum AnnotationParsingMode {
|
||||||
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false),
|
FILE_ANNOTATIONS_BEFORE_PACKAGE(false, true, false, true),
|
||||||
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false),
|
FILE_ANNOTATIONS_WHEN_PACKAGE_OMITTED(false, true, false, true),
|
||||||
ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false),
|
ONLY_ESCAPED_REGULAR_ANNOTATIONS(false, false, false, true),
|
||||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false),
|
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS(true, false, false, true),
|
||||||
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true),
|
ALLOW_UNESCAPED_REGULAR_ANNOTATIONS_AT_MEMBER_MODIFIER_LIST(true, false, true, true),
|
||||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false),
|
PRIMARY_CONSTRUCTOR_MODIFIER_LIST(true, false, false, true),
|
||||||
PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL(false, false, false);
|
PRIMARY_CONSTRUCTOR_MODIFIER_LIST_LOCAL(false, false, false, true),
|
||||||
|
NO_ANNOTATIONS(false, false, false, false);
|
||||||
|
|
||||||
|
|
||||||
boolean allowShortAnnotations;
|
boolean allowShortAnnotations;
|
||||||
boolean isFileAnnotationParsingMode;
|
boolean isFileAnnotationParsingMode;
|
||||||
boolean atMemberStart;
|
boolean atMemberStart;
|
||||||
|
boolean allowAnnotations;
|
||||||
|
|
||||||
AnnotationParsingMode(
|
AnnotationParsingMode(
|
||||||
boolean allowShortAnnotations,
|
boolean allowShortAnnotations,
|
||||||
boolean isFileAnnotationParsingMode,
|
boolean isFileAnnotationParsingMode,
|
||||||
boolean atMemberStart
|
boolean atMemberStart,
|
||||||
|
boolean allowAnnotations
|
||||||
) {
|
) {
|
||||||
this.allowShortAnnotations = allowShortAnnotations;
|
this.allowShortAnnotations = allowShortAnnotations;
|
||||||
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
|
this.isFileAnnotationParsingMode = isFileAnnotationParsingMode;
|
||||||
this.atMemberStart = atMemberStart;
|
this.atMemberStart = atMemberStart;
|
||||||
|
this.allowAnnotations = allowAnnotations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,3 +1,5 @@
|
|||||||
annotation class base
|
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
|
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 {
|
@kotlin.annotation.annotation() public final class base : kotlin.Annotation {
|
||||||
public constructor base()
|
public constructor base()
|
||||||
|
|||||||
+2
-3
@@ -79,7 +79,7 @@ JetFile: TypeAnnotations.kt
|
|||||||
TYPE_ARGUMENT_LIST
|
TYPE_ARGUMENT_LIST
|
||||||
PsiElement(LT)('<')
|
PsiElement(LT)('<')
|
||||||
TYPE_PROJECTION
|
TYPE_PROJECTION
|
||||||
MODIFIER_LIST
|
TYPE_REFERENCE
|
||||||
ANNOTATION
|
ANNOTATION
|
||||||
PsiElement(AT)('@')
|
PsiElement(AT)('@')
|
||||||
PsiElement(LBRACKET)('[')
|
PsiElement(LBRACKET)('[')
|
||||||
@@ -90,8 +90,7 @@ JetFile: TypeAnnotations.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('x')
|
PsiElement(IDENTIFIER)('x')
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('A')
|
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 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 */ }
|
public final fun <A> (A.(A) -> A)?.bar(): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,13 @@ PsiJetFileStubImpl[package=test]
|
|||||||
TYPE_ARGUMENT_LIST:
|
TYPE_ARGUMENT_LIST:
|
||||||
TYPE_PROJECTION:[projectionKind=NONE]
|
TYPE_PROJECTION:[projectionKind=NONE]
|
||||||
TYPE_REFERENCE:
|
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]
|
||||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||||
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
||||||
|
|||||||
Reference in New Issue
Block a user