FIR: Use NullableAny as a default bound
This commit is contained in:
+1
-1
@@ -176,7 +176,7 @@ object FirJavaGenericVarianceViolationTypeChecker : FirFunctionCallChecker() {
|
|||||||
return when (this) {
|
return when (this) {
|
||||||
is ConeKotlinTypeProjectionOut -> if (isCovariant) type else this
|
is ConeKotlinTypeProjectionOut -> if (isCovariant) type else this
|
||||||
is ConeKotlinTypeProjectionIn -> ConeKotlinTypeProjectionIn(type.removeOutProjection(!isCovariant))
|
is ConeKotlinTypeProjectionIn -> ConeKotlinTypeProjectionIn(type.removeOutProjection(!isCovariant))
|
||||||
is ConeStarProjection -> if (isCovariant) StandardTypes.Any else this
|
is ConeStarProjection -> if (isCovariant) StandardTypes.NullableAny else this
|
||||||
// Don't remove nested projections for types at invariant position.
|
// Don't remove nested projections for types at invariant position.
|
||||||
is ConeKotlinTypeConflictingProjection,
|
is ConeKotlinTypeConflictingProjection,
|
||||||
is ConeKotlinType -> this
|
is ConeKotlinType -> this
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ object StandardTypes {
|
|||||||
val Double: ConeClassLikeType = StandardClassIds.Double.createType()
|
val Double: ConeClassLikeType = StandardClassIds.Double.createType()
|
||||||
|
|
||||||
val Any: ConeClassLikeType = StandardClassIds.Any.createType()
|
val Any: ConeClassLikeType = StandardClassIds.Any.createType()
|
||||||
|
val NullableAny: ConeClassLikeType = StandardClassIds.Any.createType(isNullable = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ClassId.createType(): ConeClassLikeType =
|
private fun ClassId.createType(isNullable: Boolean = false): ConeClassLikeType =
|
||||||
ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), emptyArray(), isNullable = false)
|
ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), emptyArray(), isNullable)
|
||||||
|
|
||||||
fun ConeClassLikeType.isDouble(): Boolean = lookupTag.classId == StandardClassIds.Double
|
fun ConeClassLikeType.isDouble(): Boolean = lookupTag.classId == StandardClassIds.Double
|
||||||
fun ConeClassLikeType.isFloat(): Boolean = lookupTag.classId == StandardClassIds.Float
|
fun ConeClassLikeType.isFloat(): Boolean = lookupTag.classId == StandardClassIds.Float
|
||||||
|
|||||||
Reference in New Issue
Block a user