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
defnonnull[T](x: T|Null): x.type&T=if (x ==null) thrownewNullPointerException("tried to cast away nullability, but value is null")
else x.asInstanceOf[x.type&T]
errors with
--Error: test.scala:3:24------------------------------------------------------3|else x.asInstanceOf[x.type&T]
|^^^^^^| (x : T|Null) &T is not stable
1 error found
this makes it hard to define other APIs in user code that eliminate Null, such as Option.apply