You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It does work if you make Null a separate class, or you compile with -Yexplicit-nulls.
The way things are Null is a bottom type. So every class instance of Optional[C] is in fact C.
I tried to change the definition of Optional to
typeOptional[A] =A
then the implicit is not found either. So the problem looks like not a problem with union types at all. If Optional[A] defines a real union it works. It looks rather like a limitation of HK type inference that it cannot infer identities. That's actually expected, I think.
Compiler version
3.0.0-RC1
Minimized code & Output
https://scastie.scala-lang.org/uvY5sVNcSJuNGBiMPM5zKQ
Expectation
Successful compilation but got an error
The text was updated successfully, but these errors were encountered: