[NI] Consider intersection type with number type as Nothing

Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*>

 #KT-37302 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-03-22 23:25:12 +03:00
parent b23aff4d0d
commit 191fb02bf6
26 changed files with 242 additions and 92 deletions
@@ -56,7 +56,13 @@ object KotlinTypeFactory {
)
}
is TypeAliasDescriptor -> ErrorUtils.createErrorScope("Scope for abbreviation: ${descriptor.name}", true)
else -> throw IllegalStateException("Unsupported classifier: $descriptor for constructor: $constructor")
else -> {
if (constructor is IntersectionTypeConstructor) {
return constructor.createScopeForKotlinType()
}
throw IllegalStateException("Unsupported classifier: $descriptor for constructor: $constructor")
}
}
}
@@ -545,7 +545,7 @@ public class TypeUtils {
return literalTypeConstructor.getApproximatedType();
}
// If approximated type does not mathc expected type then expected type is very
// If approximated type does not match expected type then expected type is very
// specific type (e.g. Comparable<Byte>), so only one of possible types could match it
KotlinType approximatedType = literalTypeConstructor.getApproximatedType();
if (KotlinTypeChecker.DEFAULT.isSubtypeOf(approximatedType, expectedType)) {