[NI] Fix reporting smartcast diagnostics for intersection types
#KT-30826 Fixed
This commit is contained in:
@@ -243,3 +243,12 @@ val TypeParameterDescriptor.representativeUpperBound: KotlinType
|
||||
} ?: upperBounds.first()
|
||||
}
|
||||
|
||||
fun KotlinType.expandIntersectionTypeIfNecessary(): Collection<KotlinType> {
|
||||
if (constructor !is IntersectionTypeConstructor) return listOf(this)
|
||||
val types = constructor.supertypes
|
||||
return if (isMarkedNullable) {
|
||||
types.map { it.makeNullable() }
|
||||
} else {
|
||||
types
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user