Closed Linyxus closed 2 years ago
I'm not sure this is a bug. Same behavior in Scala 2. https://scastie.scala-lang.org/wvu8P6QkQAKujvrsXv2gDg
It's is/was a bug in Scala 2 too! There's no reason e1.T
can't widen to Int
there, that I can think of.
We should not allow this to compile unless we also ensure that it emits an unchecked warning.
Unassigning myself since if there's anything in the compiler I will be taking a look at anytime soon, it will be issues directly related to GADTs.
Compiler version
3.1.0
Minimized code
Output
Expectation
The code should be accepted, since
e1.T
is defined to be the subtype ofInt
. However, by inspecting the typer, we found that the pattern will be typed as_: Expr{type T = _}
where_
is the wildcard type, and the information about the bounds<: Int
gets lost.