-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No warning on typecase pattern involving a case class #11178
Comments
Seems related to #4298 |
I came across the same error and I found that a warning is issued if the type is invariant but not if it's covariant or contravariant: // Invariant case, OK
sealed trait Bar[A]
def test[A](bar: Bar[A]) =
bar match {
case _: Bar[Boolean] => ??? // unchecked warning, OK
case _ => ???
} // Covariant case, not OK
sealed trait Bar[+A]
def test[A](bar: Bar[A]) =
bar match {
case _: Bar[Boolean] => ??? // no warning, not OK
case _ => ???
} // Contravariant case, not OK
sealed trait Bar[-A]
def test[A](bar: Bar[A]) =
bar match {
case _: Bar[Boolean] => ??? // no warning, not OK
case _ => ???
} |
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 16, 2021
This reverts scala#9789. We have made several improvements to F-bounds, the unsound tweak is no longer needed.
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 16, 2021
This reverts scala#9789. We have made several improvements to F-bounds, the unsound tweak is no longer needed.
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 17, 2021
This reverts scala#9789. We have made several improvements to F-bounds, the unsound tweak is no longer needed.
liufengyun
added a commit
that referenced
this issue
Mar 17, 2021
Fix #11178: remove unsound tweak for F-bounds in isInstanceOf check
michelou
pushed a commit
to michelou/dotty
that referenced
this issue
Mar 22, 2021
This reverts scala#9789. We have made several improvements to F-bounds, the unsound tweak is no longer needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minimized code
Output
Compiles with no warning, which is not OK.
Expectation
At least a warning about a pattern that cannot be checked at runtime should be emitted. The code shouldn't typecheck as well, but that's a secondary problem.
The text was updated successfully, but these errors were encountered: