Skip to content
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

Add type information to goog.global referenced objects #503

Merged
merged 3 commits into from
Aug 11, 2015

Conversation

ChadKillingsworth
Copy link
Contributor

The xhr object created via goog.global was an unknown type and thus blocked disambiguation on properties named "open" or "send".

Fixes google/closure-compiler#1054

…unknown and blocking disambiguation on properties named "open" or "send".
@@ -1396,6 +1396,7 @@ goog.loadFileSync_ = function(src) {
if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
return goog.global.CLOSURE_LOAD_FILE_SYNC(src);
} else {
/** @type {XMLHttpRequest} */
var xhr = new goog.global['XMLHttpRequest']();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we can just kill the bracket notation here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option would be to increase the bracket usage:

xhr['open']('get', src, false);

This is also occurring on Line 850 which doesn't use brackets.

@concavelenz
Copy link
Contributor

You would also need to add a "goog.forwardDeclare" for this type, this is there to support projects using minimal externs.

@ChadKillingsworth ChadKillingsworth changed the title Add type information to goog.loadFileSync_. Add type information to goog.global referenced objects Aug 10, 2015
@ChadKillingsworth
Copy link
Contributor Author

Added the needed goog.forwardDeclare calls and type casts to more objects.

concavelenz added a commit that referenced this pull request Aug 11, 2015
Add type information to goog.global referenced objects.
@concavelenz concavelenz merged commit bbb7ae6 into google:master Aug 11, 2015
@ChadKillingsworth ChadKillingsworth deleted the fix-unknown-type-in-base branch August 11, 2015 13:04
joeltine added a commit that referenced this pull request Aug 12, 2015
Add type information to goog.global referenced objects.

-------------
Created by MOE: http://code.google.com/p/moe-java
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=100492682
joeltine added a commit that referenced this pull request Aug 14, 2015
*** Reason for rollback ***

Breaks test

With this rollback, all tests pass.

*** Original change description ***

Merge pull request #503 from ChadKillingsworth/fix-unknown-type-in-base

Add type information to goog.global referenced objects.

-------------
Created by MOE: http://code.google.com/p/moe-java

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=100526080
joeltine added a commit that referenced this pull request Aug 14, 2015
*** Reason for rollback ***

Roll forward once is in to unbreak tests after this change.

(I'm queuing these up since the presubmits are long.)

*** Original change description ***

Automated g4 rollback of changelist 100492682.

*** Reason for rollback ***

Breaks tests

*** Original change description ***

Merge pull request #503 from ChadKillingsworth/fix-unknown-type-in-base

Add type information to goog.global referenced obj...

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=100537995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants