Closed
Description
I'm not sure what the semantics of Null should be exactly, but:
object O {
// This compiles
val a: { type T } = null;
val b: Any { type T } = null;
// This doesn't:
// found : Null
// required: AnyRef{T}
val c: AnyRef { type T } = null;
}
The problem is that the null subtyping check is done with:
(tp1.symbol eq NullClass) && tp2.dealias.typeSymbol.isNullableClass
But AnyRef
is not a class (it's an alias of Object
) so isNullableClass
fails. What would be the most robust way to fix this?
By the way, should we remove NotNull
? It's been deprecated in scalac already: scala/scala#2244
CC @odersky