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
[error] 4 | def hmmm: UndefOr[A] = ???
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] |covariant type A occurs in invariant position in type => scala.scalajs.js.UndefOr[A] of method hmmm
Expectation
It should compile (and does with Scala 2.x) because UndefOr is covariant.
I don't know what's going on here but you should try again with a nightly since we completely changed how Scala.js unions work in Scala 3 (they're regular Scala 3 unions now): #11671
Compiler version
3.0.0-RC1 with Scala.JS 1.5.0
Minimized code
This reproduction requires Scala.JS 1.5.0:
I tried to make a reproduction without Scala.JS (see below) but I couldn't get the bug to occur.
Output
Expectation
It should compile (and does with Scala 2.x) because
UndefOr
is covariant./cc @sjrd
The text was updated successfully, but these errors were encountered: