K2: introduce unwrapFlexibleAndDefinitelyNotNull
This commit is contained in:
committed by
Space Team
parent
b76452e15f
commit
37789cf7f5
+1
-1
@@ -77,5 +77,5 @@ object FirCyclicTypeBoundsChecker : FirBasicDeclarationChecker() {
|
|||||||
ref.unwrapBound().mapNotNull { extractTypeParamName(it.coneType) }.toSet()
|
ref.unwrapBound().mapNotNull { extractTypeParamName(it.coneType) }.toSet()
|
||||||
|
|
||||||
private fun extractTypeParamName(type: ConeKotlinType): Name? =
|
private fun extractTypeParamName(type: ConeKotlinType): Name? =
|
||||||
(type.lowerBoundIfFlexible().unwrapDefinitelyNotNull() as? ConeTypeParameterType)?.lookupTag?.name
|
(type.unwrapFlexibleAndDefinitelyNotNull() as? ConeTypeParameterType)?.lookupTag?.name
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ object FirTopLevelTypeAliasChecker : FirTypeAliasChecker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun containsTypeParameter(type: ConeKotlinType): Boolean {
|
fun containsTypeParameter(type: ConeKotlinType): Boolean {
|
||||||
val unwrapped = type.lowerBoundIfFlexible().unwrapDefinitelyNotNull()
|
val unwrapped = type.unwrapFlexibleAndDefinitelyNotNull()
|
||||||
|
|
||||||
if (unwrapped is ConeTypeParameterType) {
|
if (unwrapped is ConeTypeParameterType) {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ fun ConeSimpleKotlinType.unwrapDefinitelyNotNull(): ConeSimpleKotlinType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ConeKotlinType.unwrapFlexibleAndDefinitelyNotNull(): ConeKotlinType {
|
||||||
|
return lowerBoundIfFlexible().unwrapDefinitelyNotNull()
|
||||||
|
}
|
||||||
|
|
||||||
class ConeCapturedTypeConstructor(
|
class ConeCapturedTypeConstructor(
|
||||||
val projection: ConeTypeProjection,
|
val projection: ConeTypeProjection,
|
||||||
var supertypes: List<ConeKotlinType>? = null,
|
var supertypes: List<ConeKotlinType>? = null,
|
||||||
|
|||||||
Reference in New Issue
Block a user