-
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
Incorrect Match case Unreachable warning #18736
Comments
If "sealed" is removed, the compiler gives no warning. If the intermediate "SubTrait" is removed, the compiler gives no warning. If "{ type Self = T }" in the type bound is removed, the compiler gives no warning. |
The issue here is we don't infer type members. So when considering |
Should the issue be classified as an enhancement or is it rather a bug? I would think a false warning of an unreachable case is always an error. We are permitted to not warn if a case is unreachable in the runtime semantics, but we are not allowed to issue spurious warnings like this one. An alternative would be if we had a linter option to report "suspected unreachable warnings". That could have false positives. But this unconditional warning should never fire spuriously. |
Compiler version
3.3.1
Minimized code
Output
Expectation
Running the main prints both cases as expected, so both cases are in fact reachable.
The text was updated successfully, but these errors were encountered: