-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Invalid unreachable case warning on Java-defined class with unbounded type parameter #15717
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
Comments
Nice catch! Thanks for the report. Also reproduces on latest nightly. Presumably it's crucial that |
The nested pattern match isn't needed; the following is a sufficient reproducer: def foo(xs: java.util.Vector[_]): Unit =
xs.get(0) match {
case d: Double =>
case _ =>
} (A second case is needed in order for redundancy checking to kick in.) |
Note that you get the same unreachable warning if you change the type of xs to (Dale believes this was an intentional design change in Scala 3, but we're not sure if there's a ticket or discussion of record on that. But the long comment at the top of |
Maybe it's “simply” that the redundancy checker “just” needs to be made to handle We've verified that an upper bound of |
Indeed, it was actually that simple. The right |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.1.3
Minimized code
Output
unreachable case
warning on line indicated with commentExpectation
Running the app shows that the case is used so I'd expect no warning.
The second match statement doesn't have a warning for
case d: Double
so why does the first?I get the correct warnings if
getValues
is not returned asObject
.I don't think this is the same as other open
unreachable case
issues. It doesn't involve unions or nullsThe text was updated successfully, but these errors were encountered: