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
There is no reason why the return type of a function producing a union type can't be erased to its lub.
There is an issue however with supplying widened unions to dotty methods, unless more work is done to the compiler to enforce precision, such as adapting to something precise but is then erased, like scala.js union
The text was updated successfully, but these errors were encountered:
My idea for union types is to basically upstream a version of Scala.js' union type into scala/scala, making sure that it is entirely erased away, so that forward bin compat is not an issue (or, failing that, to put it hidden in dotty-library, which will always be on the classpath when depending on a dotty-compiled library).
We would just have to special-case erasure so that A | B erases the same way as it does on dotty (i.e., to the LUB of A and B) rather than Object.
Other than that, there is no change required to the type system, since it is entirely driven by implicit conversions with implicit proof derivations.
We could then have the tasty reader translate dotty's true | into that fake |.
There is no reason why the return type of a function producing a union type can't be erased to its lub.
There is an issue however with supplying widened unions to dotty methods, unless more work is done to the compiler to enforce precision, such as adapting to something precise but is then erased, like scala.js union
The text was updated successfully, but these errors were encountered: