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
[SILGen] Silence redundant unreachable enum case warning #33336
Conversation
IIRC there isn't perfect overlap between the two diagnostics, so disabling either one will cause us to miss cases the other doesn't catch either. @CodaFi how does this sound to you now? |
The space engine only has incomplete redundancy checking for expression patterns - there we do something awful that approximates redundancy checking for (non-range) literals. Proper patterns always emit overlap diagnostics, so we could at least ditch SIL's diagnostics for those cases. |
I have updated the implementation to check for Is there a test case that triggers redundant warning for |
Ping. Does the change look good now @CodaFi? |
Ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Joe can sign off on SIL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me too.
@swift-ci please smoke test |
When an enum case is already handled, for example:
We would get two warnings on
case .b
:case is already handled by previous patterns; consider removing it
&case will never be executed
. The first warning comes from Space Engine and the second warning comes from SILGenPattern.So, silence the (redundant) warning emitted by SILGenPattern for switch statements (except
default
case).Resolves #54657
Resolves rdar://problem/59655513