FIR Java: simplify flexible nullability manipulations
This commit is contained in:
committed by
teamcityserver
parent
fc7f589caa
commit
b658e99f91
@@ -200,7 +200,7 @@ private fun ClassId.toConeFlexibleType(
|
||||
toConeKotlinType(
|
||||
typeArguments,
|
||||
isNullable = false,
|
||||
attributes.intersectUnless(ConeAttributes.WithFlexibleNullability) { it.hasEnhancedNullability }
|
||||
attributes.withFlexibleUnless { it.hasEnhancedNullability }
|
||||
),
|
||||
toConeKotlinType(typeArgumentsForUpper, isNullable = true, attributes)
|
||||
)
|
||||
@@ -242,7 +242,7 @@ private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
||||
else
|
||||
ConeFlexibleType(
|
||||
lowerBound.withAttributes(
|
||||
lowerBound.attributes.intersectUnless(ConeAttributes.WithFlexibleNullability) { it.hasEnhancedNullability }
|
||||
lowerBound.attributes.withFlexibleUnless { it.hasEnhancedNullability }
|
||||
),
|
||||
upperBound
|
||||
)
|
||||
@@ -316,7 +316,7 @@ private fun getErasedVersionOfFirstUpperBound(
|
||||
// Avoid exponential complexity
|
||||
ConeFlexibleType(
|
||||
lowerBound.withAttributes(
|
||||
lowerBound.attributes.intersectUnless(ConeAttributes.WithFlexibleNullability) { it.hasEnhancedNullability }
|
||||
lowerBound.attributes.withFlexibleUnless { it.hasEnhancedNullability }
|
||||
),
|
||||
lowerBound.withNullability(ConeNullability.NULLABLE)
|
||||
)
|
||||
|
||||
@@ -92,7 +92,7 @@ private fun ConeKotlinType.enhanceConeKotlinType(
|
||||
val lowerResult = lowerBound.enhanceInflexibleType(
|
||||
session, TypeComponentPosition.FLEXIBLE_LOWER, qualifiers, index,
|
||||
attributes = if (needsFlexibleNullabilityAttribute)
|
||||
lowerBound.attributes.intersect(ConeAttributes.WithFlexibleNullability)
|
||||
lowerBound.attributes.withFlexible()
|
||||
else
|
||||
lowerBound.attributes
|
||||
)
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ class JavaClassMembersEnhancementScope(
|
||||
if (valueParameter.returnTypeRef.coneType is ConeFlexibleType) {
|
||||
ConeFlexibleType(
|
||||
type.withAttributes(
|
||||
type.attributes.intersectUnless(ConeAttributes.WithFlexibleNullability) {
|
||||
type.attributes.withFlexibleUnless {
|
||||
it.hasEnhancedNullability
|
||||
}
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user