[FE 1.0] Properly handle intersection types in check if cast possible or not
^KT-47685 Fixed
This commit is contained in:
committed by
teamcityserver
parent
f0c4d06fc9
commit
47b0071560
@@ -43,6 +43,10 @@ object CastDiagnosticsUtil {
|
||||
rhsType: KotlinType,
|
||||
platformToKotlinClassMapper: PlatformToKotlinClassMapper
|
||||
): Boolean {
|
||||
val typeConstructor = lhsType.constructor
|
||||
if (typeConstructor is IntersectionTypeConstructor) {
|
||||
return typeConstructor.supertypes.any { isCastPossible(it, rhsType, platformToKotlinClassMapper) }
|
||||
}
|
||||
val rhsNullable = TypeUtils.isNullableType(rhsType)
|
||||
val lhsNullable = TypeUtils.isNullableType(lhsType)
|
||||
if (KotlinBuiltIns.isNothing(lhsType)) return true
|
||||
|
||||
Reference in New Issue
Block a user