-
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
What is the annotation to hide warning from unreachable code? #4113
Comments
I see there is this in code: static final DiagnosticType UNREACHABLE_CODE = DiagnosticType.warning(
"JSC_UNREACHABLE_CODE", "unreachable code"); and running
but I don't know how to translate that code |
Yep, it's You can look this up in https://github.com/google/closure-compiler/wiki/@suppress-annotations#error-to-suppression-map. I added a link from https://github.com/google/closure-compiler/wiki/Warnings#warnings-categories. |
Great, thanks! Btw, I wonder if it might make sense to directly print it in the warning/error that appears, like GCC and Clang do? E.g. currently the warning prints Why not print |
Or alternatively, would it be possible to support The two different warning code namespaces makes me confused, wondering why both need to exist, and why I as user need to know to map between the two. Would seem to be easier to just present and use one code namespace? |
I agree it's confusing. We talked as a team earlier this year about both possibilities you've suggested but I don't see that we ever filed an issue to track it, so created #4114. |
It looks like the documentation page does not document the mechanism to mute a warning that stems from unreachable code?
I am getting
where the unreachable code is intentional. I would like to annotate the whole function to not warn about this, but the doc page https://github.com/google/closure-compiler/wiki/Warnings does not have any mention about
"unreachable"
.Is this a case of documentation missing a spot, or is this feature missing?
The text was updated successfully, but these errors were encountered: