Nullability of intersection type should be determined by supertypes
Intersection types cannot be nullable as is because of special rules for subtyping
This commit is contained in:
@@ -265,6 +265,14 @@ public class TypeUtils {
|
||||
if (isTypeParameter(type)) {
|
||||
return hasNullableSuperType(type);
|
||||
}
|
||||
|
||||
TypeConstructor constructor = type.getConstructor();
|
||||
if (constructor instanceof IntersectionTypeConstructor) {
|
||||
for (KotlinType supertype : constructor.getSupertypes()) {
|
||||
if (isNullableType(supertype)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user