FIR2IR: add implicit NOT_NULL cast for @FlexibleNullability type
This commit is contained in:
committed by
teamcityserver
parent
b658e99f91
commit
4cb32cd38a
@@ -138,3 +138,20 @@ private fun ConeTypeParameterType.hasNotNullUpperBound(): Boolean {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val FirTypeRef.canBeNull: Boolean
|
||||
get() = coneType.canBeNull
|
||||
|
||||
val ConeKotlinType.canBeNull: Boolean
|
||||
get() {
|
||||
if (isMarkedNullable) {
|
||||
return true
|
||||
}
|
||||
return when (this) {
|
||||
is ConeFlexibleType -> upperBound.canBeNull
|
||||
is ConeDefinitelyNotNullType -> false
|
||||
is ConeTypeParameterType -> this.lookupTag.typeParameterSymbol.fir.bounds.any { it.canBeNull }
|
||||
is ConeIntersectionType -> intersectedTypes.any { it.canBeNull }
|
||||
else -> isNullable
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user