Drop support for T!! syntactic structure
^KT-26245 In Progress
This commit is contained in:
committed by
teamcityserver
parent
302eacbf59
commit
c1b5d5551f
@@ -159,7 +159,6 @@ public interface Errors {
|
||||
DiagnosticFactory2<KtTypeReference, KotlinType, KotlinType> UPPER_BOUND_VIOLATED = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<KtTypeReference, KotlinType, KotlinType> UPPER_BOUND_VIOLATED_WARNING = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory0<KtNullableType> REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
|
||||
DiagnosticFactory0<KtDefinitelyNotNullType> DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtNullableType> NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> INCORRECT_LEFT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@@ -844,7 +844,6 @@ object PositioningStrategies {
|
||||
return when (this) {
|
||||
is KtUserType -> referenceExpression
|
||||
is KtNullableType -> innerType?.getReferencedTypeExpression()
|
||||
is KtDefinitelyNotNullType -> innerType?.getReferencedTypeExpression()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -694,7 +694,6 @@ public class DefaultErrorMessages {
|
||||
MAP.put(NULLABLE_SUPERTYPE, "A supertype cannot be nullable");
|
||||
MAP.put(DYNAMIC_SUPERTYPE, "A supertype cannot be dynamic");
|
||||
MAP.put(REDUNDANT_NULLABLE, "Redundant '?'");
|
||||
MAP.put(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE, "'!!' is only applicable to type parameters with nullable upper bounds");
|
||||
MAP.put(NULLABLE_ON_DEFINITELY_NOT_NULLABLE, "'!!' type cannot be marked as nullable");
|
||||
MAP.put(INCORRECT_LEFT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: left part should be a type parameter with nullable bounds");
|
||||
MAP.put(INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: right part should be non-nullable Any");
|
||||
|
||||
@@ -290,33 +290,6 @@ class TypeResolver(
|
||||
return resolveTypeElement(c, innerAnnotations, outerModifierList ?: innerModifierList, innerType)
|
||||
}
|
||||
|
||||
override fun visitDefinitelyNotNullType(definitelyNotNullType: KtDefinitelyNotNullType) {
|
||||
val baseType =
|
||||
createTypeFromInner(definitelyNotNullType, definitelyNotNullType.modifierList, definitelyNotNullType.innerType)
|
||||
|
||||
if (!languageVersionSettings.supportsFeature(LanguageFeature.DefinitelyNotNullTypeParameters)) {
|
||||
result = baseType
|
||||
c.trace.report(
|
||||
UNSUPPORTED_FEATURE.on(
|
||||
definitelyNotNullType,
|
||||
LanguageFeature.DefinitelyNotNullTypeParameters to languageVersionSettings
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
val definitelyNotNullKotlinType =
|
||||
if (!baseType.isBare) DefinitelyNotNullType.makeDefinitelyNotNull(baseType.actualType.unwrap()) else null
|
||||
|
||||
if (definitelyNotNullKotlinType == null) {
|
||||
result = baseType
|
||||
c.trace.report(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE.on(definitelyNotNullType))
|
||||
return
|
||||
}
|
||||
|
||||
result = type(definitelyNotNullKotlinType)
|
||||
}
|
||||
|
||||
override fun visitIntersectionType(intersectionType: KtIntersectionType) {
|
||||
val leftType = resolvePossiblyBareType(c, intersectionType.getLeftTypeRef() ?: return).let {
|
||||
when {
|
||||
|
||||
Reference in New Issue
Block a user