-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Suppress missing require from externs #1192
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
Suppress missing require from externs #1192
Conversation
@@ -182,7 +183,8 @@ private void visitScriptNode(NodeTraversal t) { | |||
(requires == null || (!requires.containsKey(className) | |||
&& !requires.containsKey(outermostClassName) | |||
&& !requires.containsKey(parentNamespace))); | |||
if (notProvidedByConstructors && notProvidedByRequires | |||
boolean notProvidedByExterns = scopeVar==null || !scopeVar.isExtern(); |
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.
nit: spaces around the ==
I thought the existing var.isExtern() check on line 406 was supposed to make this work. We should figure out why it's not. |
Looks live visitNewNode doesn't call maybeAddUsage |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
10077c2
to
cdc333b
Compare
CLAs look good, thanks! |
I'm afraid I broke this PR when I rebased and resolved conflicts with a formatting change. I've committed a fix. |
Closing, reworked here: |
This is to fix the case where you have React defined globally in externs:
Without this PR you get the following warning, which is incorrect since externs don't need to be required as they are global:
If this is accepted, PR #1147 for suppressing missing requires on class nodes can be deleted.