Do not parse !! as part of annotation type

^KT-26245 Related
This commit is contained in:
Denis.Zharkov
2021-04-07 19:02:51 +03:00
committed by TeamCityServer
parent 37f923a98f
commit 16ca8ddbbd
3 changed files with 61 additions and 5 deletions
@@ -833,7 +833,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
PsiBuilder.Marker reference = mark();
PsiBuilder.Marker typeReference = mark();
parseUserType();
parseUserType(/* forAnnotation */ true);
typeReference.done(TYPE_REFERENCE);
reference.done(CONSTRUCTOR_CALLEE);
@@ -2078,7 +2078,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
dynamicType.done(DYNAMIC_TYPE);
}
else if (at(IDENTIFIER) || at(PACKAGE_KEYWORD) || atParenthesizedMutableForPlatformTypes(0)) {
parseUserType();
parseUserType(/* forAnnotation */ false);
}
else if (at(LPAR)) {
PsiBuilder.Marker functionOrParenthesizedType = mark();
@@ -2175,7 +2175,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
* - (Mutable)List<Foo>!
* - Array<(out) Foo>!
*/
private void parseUserType() {
private void parseUserType(boolean forAnnotation) {
PsiBuilder.Marker userType = mark();
if (at(PACKAGE_KEYWORD)) {
@@ -2221,7 +2221,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
userType.done(USER_TYPE);
if (at(EXCLEXCL)) {
if (!forAnnotation && at(EXCLEXCL)) {
PsiBuilder.Marker definitelyNotNull = userType.precede();
advance(); // !!
definitelyNotNull.done(DEFINITELY_NOT_NULL_TYPE);