Repository: google/closure-compiler
Pull request #952 (2015-05-15 22:51:56)

Make ProcessCommonJSModules, ProcessEs6Modules and ES6ModuleLoader public
For this year's GSoC project, we are planning to add CommonJS, ECMAScript 6 and AMD module support to ClojureScript and would like to use functionality that is already provided by the Google Closure Compiler. Instead of using this functionality indirectly through the Compiler class we would like to use the ProcessCommonJSModules, ProcessEs6Modules and ES6ModuleLoader classes directly to make it easier for us to support incremental compilation.

I have signed the CLA and David Nolen, who is my mentor for this project, asked about this change on the mailing list [1].

[1] https://groups.google.com/forum/#!topic/closure-compiler-discuss/C8yfc6ImDkI


Patch:
diff --git a/contrib/externs/angular-material.js b/contrib/externs/angular-material.js
index e4c12bf29..5b1540687 100644
--- a/contrib/externs/angular-material.js
+++ b/contrib/externs/angular-material.js
@@ -201,7 +201,7 @@ md.$toast.prototype.cancel = function() {};
  *   highlightAction: function(boolean):md.$toast.preset,
  *   capsule: function(boolean):md.$toast.preset,
  *   position: function(string):md.$toast.preset,
- *   hideDelay: function(number):md.$toast.preset
+ *   hidedelay: function(number):md.$toast.preset
  * }}
  */
 md.$toast.preset;
diff --git a/contrib/externs/chrome_extensions.js b/contrib/externs/chrome_extensions.js
index 60b6b21fb..db74d6448 100644
--- a/contrib/externs/chrome_extensions.js
+++ b/contrib/externs/chrome_extensions.js
@@ -173,18 +173,6 @@
  */
 
 
-/*
- * Ensure projects don't execute this file.
- * The throw is to catch executions of this file, however, without the guard,
- * the compiler's flow analysis stops at the throw, even for an externs file.
- * Therefore, the Math.random() guard fools the compiler during externs
- * processing.
- */
-if (Math.random() < 1) {  // always true but the compiler doesn't know that
-  throw 'Externs file "chrome_extensions.js" should not be executed';
-}
-
-
 /**
  * @see https://developer.chrome.com/extensions/accessibilityFeatures
  * @const
@@ -2080,11 +2068,6 @@ chrome.runtime.id;
 chrome.runtime.getBackgroundPage = function(callback) {};
 
 
-/**
- * @param {function(): void=} opt_callback Callback function.
- */
-chrome.runtime.openOptionsPage = function(opt_callback) {};
-
 
 /**
  * Manifest information returned from chrome.runtime.getManifest. See
@@ -8950,10 +8933,6 @@ chrome.networkingPrivate.onNetworksChanged;
 chrome.networkingPrivate.onNetworkListChanged;
 
 
-/** @type {!ChromeEvent} */
-chrome.networkingPrivate.onDeviceStateListChanged;
-
-
 /** @type {!ChromeStringStringEvent} */
 chrome.networkingPrivate.onPortalDetectionCompleted;
 
diff --git a/externs/es6.js b/externs/es6.js
index f7374c888..f400d500a 100644
--- a/externs/es6.js
+++ b/externs/es6.js
@@ -784,7 +784,7 @@ DataView.prototype.setFloat64 = function(
 
 /**
  * @see https://github.com/promises-aplus/promises-spec
- * @typedef {{then: ?}}
+ * @typedef {{then: !Function}}
  */
 var Thenable;
 
diff --git a/externs/fetchapi.js b/externs/fetchapi.js
deleted file mode 100644
index 0a0f8336e..000000000
--- a/externs/fetchapi.js
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright 2014 The Closure Compiler Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @fileoverview Definitions of the fetch api.
- *
- * This api is still in development and not yet stable. Use at your
- * own risk.
- *
- * @see https://fetch.spec.whatwg.org/
- * @externs
- */
-
-/**
- * @typedef {!Headers|!Array.<!Array.<string>>}
- */
-var HeadersInit;
-
-/**
- * @see https://fetch.spec.whatwg.org/#headers
- * @param {HeadersInit=} opt_headersInit
- * @constructor
- */
-function Headers(opt_headersInit) {}
-
-/**
- * @param {string} name
- * @param {string} value
- */
-Headers.prototype.append = function(name, value) {};
-
-/**
- * @param {string} name
- */
-Headers.prototype.delete = function(name) {};
-
-/**
- * @param {string} name
- * @return {?string}
- */
-Headers.prototype.get = function(name) {};
-
-/**
- * @param {string} name
- * @return {!Array.<string>}
- */
-Headers.prototype.getAll = function(name) {};
-
-/**
- * @param {string} name
- * @return {boolean}
- */
-Headers.prototype.has = function(name) {};
-
-/**
- * @param {string} name
- * @param {string} value
- */
-Headers.prototype.set = function(name, value) {};
-
-/**
- * @typedef {!Blob|!FormData|string}
- */
-var BodyInit;
-
-/**
- * @see https://fetch.spec.whatwg.org/#request
- * @param {!RequestInfo} input
- * @param {RequestInit=} opt_init
- * @constructor
- */
-function Request(input, opt_init) {}
-
-/** @type {boolean} */
-Request.prototype.bodyUsed;
-
-/** @return {!Promise.<!ArrayBuffer>} */
-Request.prototype.arrayBuffer = function() {};
-
-/** @return {!Promise.<!Blob>} */
-Request.prototype.blob = function() {};
-
-/** @return {!Promise.<!FormData>} */
-Request.prototype.formData = function() {};
-
-/** @return {!Promise.<!Object>} */
-Request.prototype.json = function() {};
-
-/** @return {!Promise.<string>} */
-Request.prototype.text = function() {};
-
-/** @type {string} */
-Request.prototype.method;
-
-/** @type {string} */
-Request.prototype.url;
-
-/** @type {!Headers} */
-Request.prototype.headers;
-
-/** @type {RequestContext} */
-Request.prototype.context;
-
-/** @type {string} */
-Request.prototype.referrer;
-
-/** @type {RequestMode} */
-Request.prototype.mode;
-
-/** @type {RequestCredentials} */
-Request.prototype.credentials;
-
-/** @type {RequestCache} */
-Request.prototype.cache;
-
-/** @return {!Request} */
-Request.prototype.clone = function() {};
-
-/** @typedef {!Request|string} */
-var RequestInfo;
-
-/**
- * @typedef {{
- *   method: (string|undefined),
- *   headers: (!HeadersInit|undefined),
- *   body: (!BodyInit|undefined),
- *   mode: (RequestMode|undefined),
- *   credentials: (RequestCredentials|undefined),
- *   cache: (RequestCache|undefined)
- * }}
- */
-var RequestInit;
-
-/**
- * @enum {string}
- */
-var RequestContext = {
-  AUDIO: 'audio',
-  BEACON: 'beacon',
-  CSPREPORT: 'cspreport',
-  DOWNLOAD: 'download',
-  EMBED: 'embed',
-  EVENTSOURCE: 'eventsource',
-  FAVICON: 'favicon',
-  FETCH: 'fetch',
-  FONT: 'font',
-  FORM: 'form',
-  FRAME: 'frame',
-  HYPERLINK: 'hyperlink',
-  IFRAME: 'iframe',
-  IMAGE: 'image',
-  IMAGESET: 'imageset',
-  IMPORT: 'import',
-  INTERNAL: 'internal',
-  LOCATION: 'location',
-  MANIFEST: 'manifest',
-  OBJECT: 'object',
-  PING: 'ping',
-  PLUGIN: 'plugin',
-  PREFETCH: 'prefetch',
-  SCRIPT: 'script',
-  SERVICEWORKER: 'serviceworker',
-  SHAREDWORKER: 'sharedworker',
-  SUBRESOURCE: 'subresource',
-  STYLE: 'style',
-  TRACK: 'track',
-  VIDEO: 'video',
-  WORKER: 'worker',
-  XMLHTTPREQUEST: 'xmlhttprequest',
-  XSLT: 'xslt'
-};
-
-/**
- * @enum {string}
- */
-var RequestMode = {
-  SAME_ORIGIN: 'same-origin',
-  NO_CORS: 'no-cors',
-  CORS: 'cors'
-};
-
-/**
- * @enum {string}
- */
-var RequestCredentials = {
-  OMIT: 'omit',
-  SAME_ORIGIN: 'same-origin',
-  INCLUDE: 'include'
-};
-
-/**
- * @enum {string}
- */
-var RequestCache = {
-  DEFAULT: 'default',
-  NO_STORE: 'no-store',
-  RELOAD: 'reload',
-  NO_CACHE: 'no-cache',
-  FORCE_CACHE: 'force-cache',
-  ONLY_IF_CACHED: 'only-if-cached'
-};
-
-/**
- * @see https://fetch.spec.whatwg.org/#response
- * @param {BodyInit=} opt_body
- * @param {ResponseInit=} opt_init
- * @constructor
- */
-function Response(opt_body, opt_init) {}
-
-/** @return {Response} */
-Response.error = function() {};
-
-/**
- * @param {string} url
- * @param {number=} opt_status
- * @return {Response}
- */
-Response.redirect = function(url, opt_status) {};
-
-/** @type {boolean} */
-Response.prototype.bodyUsed;
-
-/** @return {!Promise.<!ArrayBuffer>} */
-Response.prototype.arrayBuffer = function() {};
-
-/** @return {!Promise.<!Blob>} */
-Response.prototype.blob = function() {};
-
-/** @return {!Promise.<!FormData>} */
-Response.prototype.formData = function() {};
-
-/** @return {!Promise.<!Object>} */
-Response.prototype.json = function() {};
-
-/** @return {!Promise.<string>} */
-Response.prototype.text = function() {};
-
-/** @type {ResponseType} */
-Response.prototype.type;
-
-/** @type {string} */
-Response.prototype.url;
-
-/** @type {number} */
-Response.prototype.status;
-
-/** @type {boolean} */
-Response.prototype.ok;
-
-/** @type {string} */
-Response.prototype.statusText;
-
-/** @type {!Headers} */
-Response.prototype.headers;
-
-/** @return {!Response} */
-Response.prototype.clone = function() {};
-
-/**
- * @typedef {{
- *   status : number,
- *   statusText: string,
- *   headers: !HeadersInit
- * }}
- */
-var ResponseInit;
-
-/**
- * @enum {string}
- */
-var ResponseType = {
-  BASIC: 'basic',
-  CORS: 'cors',
-  DEFAULT: 'default',
-  ERROR: 'error',
-  OPAQUE: 'opaque'
-};
-
-/**
- * @see https://fetch.spec.whatwg.org/#dom-global-fetch
- * @param {!RequestInfo} input
- * @param {RequestInit=} opt_init
- * @return {!Promise.<!Response>}
- */
-var fetch = function(input, opt_init) {};
-
-/**
- * @see https://fetch.spec.whatwg.org/#dom-global-fetch
- * @param {!RequestInfo} input
- * @param {RequestInit=} opt_init
- * @return {!Promise.<!Response>}
- */
-Window.prototype.fetch = function(input, opt_init) {};
-
-
-/**
- * @see https://fetch.spec.whatwg.org/#dom-global-fetch
- * @param {!RequestInfo} input
- * @param {RequestInit=} opt_init
- * @return {!Promise.<!Response>}
- */
-WorkerGlobalScope.prototype.fetch = function(input, opt_init) {};
diff --git a/externs/html5.js b/externs/html5.js
index d9d45ee73..e8a81e452 100644
--- a/externs/html5.js
+++ b/externs/html5.js
@@ -1233,12 +1233,6 @@ HTMLAreaElement.prototype.ping;
  */
 HTMLIFrameElement.prototype.srcdoc;
 
-/**
- * @type {?string}
- * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-iframe-element.html#attr-iframe-sandbox
- */
-HTMLIFrameElement.prototype.sandbox;
-
 /** @type {string} */
 HTMLInputElement.prototype.autocomplete;
 
diff --git a/externs/w3c_navigation_timing.js b/externs/w3c_navigation_timing.js
index a6cba89b9..cf0315e7e 100644
--- a/externs/w3c_navigation_timing.js
+++ b/externs/w3c_navigation_timing.js
@@ -21,7 +21,6 @@
  * @see http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
  * @see http://w3c-test.org/webperf/specs/ResourceTiming
  * @see http://www.w3.org/TR/performance-timeline
- * @see http://www.w3.org/TR/user-timing/
  *
  * @externs
  */
@@ -158,28 +157,5 @@ Performance.prototype.now = function() {};
  */
 Performance.prototype.webkitNow = function() {};
 
-/**
- * @param {string} markName
- */
-Performance.prototype.mark = function(markName) {};
-
-/**
- * @param {string=} opt_markName
- */
-Performance.prototype.clearMarks = function(opt_markName) {};
-
-/**
- * @param {string} measureName
- * @param {string=} opt_startMark
- * @param {string=} opt_endMark
- */
-Performance.prototype.measure =
-    function(measureName, opt_startMark, opt_endMark) {};
-
-/**
- * @param {string=} opt_measureName
- */
-Performance.prototype.clearMeasures = function(opt_measureName) {};
-
 /** @type {Performance} */
 Window.prototype.performance;
diff --git a/externs/w3c_serviceworker.js b/externs/w3c_serviceworker.js
deleted file mode 100644
index 47312620b..000000000
--- a/externs/w3c_serviceworker.js
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * Copyright 2014 The Closure Compiler Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @fileoverview Externs for service worker.
- *
- * @see http://www.w3.org/TR/service-workers/
- * @externs
- */
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-interface
- * @constructor
- * @extends {Worker}
- */
-function ServiceWorker() {}
-
-/** @type {string} */
-ServiceWorker.prototype.scriptURL;
-
-/** @type {ServiceWorkerState} */
-ServiceWorker.prototype.state;
-
-/** @type {?function(!Event)} */
-ServiceWorker.prototype.onstatechange;
-
-/** @enum {string} */
-var ServiceWorkerState = {
-  INSTALLING: 'installing',
-  INSTALLED: 'installed',
-  ACTIVATING: 'activating',
-  ACTIVATED: 'activated',
-  REDUNDANT: 'redundant'
-};
-
-/**
- * @see https://w3c.github.io/push-api/
- * @constructor
- */
-function PushSubscription() {}
-
-/** @type {string} */
-PushSubscription.prototype.endpoint;
-
-/**
- * Please note there is an intent to deprecate this field in Chrome 43 or 44.
- * See https://www.chromestatus.com/feature/5283829761703936.
- * @type {string}
- */
-PushSubscription.prototype.subscriptionId;
-
-/** @return {!Promise.<boolean>} */
-PushSubscription.prototype.unsubscribe = function() {};
-
-/** @enum {string} */
-// This is commented out since it has not been implemented yet in Chrome beta.
-// Uncomment once it is available.
-// var PushPermissionStatus  = {
-//  GRANTED: 'granted',
-//  DENIED: 'denied',
-//  DEFAULT: 'default'
-//};
-
-/**
- * @see https://w3c.github.io/push-api/
- * @constructor
- */
-function PushManager() {}
-
-/** @return {!Promise<PushSubscription>} */
-PushManager.prototype.subscribe = function() {};
-
-/** @return {!Promise<PushSubscription>} */
-PushManager.prototype.getSubscription = function() {};
-
-/** @return {!Promise<PushPermissionStatus>} */
-// This is commented out since it has not been implemented yet in Chrome beta.
-// Uncomment once it is available.
-// PushManager.prototype.hasPermission = function() {};
-
-
-/**
- * @see http://www.w3.org/TR/push-api/#idl-def-PushMessageData
- * @constructor
- */
-function PushMessageData() {}
-
-/** @return {!ArrayBuffer} */
-PushMessageData.prototype.arrayBuffer = function() {};
-
-/** @return {!Blob} */
-PushMessageData.prototype.blob = function() {};
-
-/** @return {*} */
-PushMessageData.prototype.json = function() {};
-
-/** @return {string} */
-PushMessageData.prototype.text = function() {};
-
-
-/**
- * @see http://www.w3.org/TR/push-api/#idl-def-PushEvent
- * @constructor
- * @param {string} type
- * @param {!ExtendableEventInit=} opt_eventInitDict
- * @extends {ExtendableEvent}
- */
-function PushEvent(type, opt_eventInitDict) {}
-
-/** @type {?PushMessageData} */
-PushEvent.prototype.data;
-
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-registration-interface
- * @interface
- * @extends {EventTarget}
- */
-function ServiceWorkerRegistration() {}
-
-/** @type {ServiceWorker} */
-ServiceWorkerRegistration.prototype.installing;
-
-/** @type {ServiceWorker} */
-ServiceWorkerRegistration.prototype.waiting;
-
-/** @type {ServiceWorker} */
-ServiceWorkerRegistration.prototype.active;
-
-/** @type {string} */
-ServiceWorkerRegistration.prototype.scope;
-
-/** @return {!Promise<boolean>} */
-ServiceWorkerRegistration.prototype.unregister = function() {};
-
-/** @type {?function(!Event)} */
-ServiceWorkerRegistration.prototype.onupdatefound;
-
-/** @type {function()} */
-ServiceWorkerRegistration.prototype.update = function() {};
-
-/**
- * @see https://w3c.github.io/push-api/
- * @type {!PushManager}
- */
-ServiceWorkerRegistration.prototype.pushManager;
-
-/**
- * @see https://notifications.spec.whatwg.org/#service-worker-api
- * @param {string} title
- * @param {NotificationOptions=} opt_options
- * @return {!Promise<void>}
- */
-ServiceWorkerRegistration.prototype.showNotification =
-    function(title, opt_options) {};
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-container-interface
- * @interface
- * @extends {EventTarget}
- */
-function ServiceWorkerContainer() {}
-
-/** @type {?ServiceWorker} */
-ServiceWorkerContainer.prototype.controller;
-
-/** @type {!Promise<!ServiceWorkerRegistration>} */
-ServiceWorkerContainer.prototype.ready;
-
-/**
- * @param {string} scriptURL
- * @param {RegistrationOptions=} opt_options
- * @return {!Promise<!ServiceWorkerRegistration>}
- */
-ServiceWorkerContainer.prototype.register = function(scriptURL, opt_options) {};
-
-/**
- * @param {string=} opt_documentURL
- * @return {!Promise<!ServiceWorkerRegistration|undefined>}
- */
-ServiceWorkerContainer.prototype.getRegistration = function(opt_documentURL) {};
-
-/**
- * @return {!Promise<Array<!ServiceWorkerRegistration>>}
- */
-ServiceWorkerContainer.prototype.getRegistrations = function() {};
-
-/** @type {?function(!Event)} */
-ServiceWorkerContainer.prototype.oncontrollerchange;
-
-/** @type {?function(!ErrorEvent)} */
-ServiceWorkerContainer.prototype.onerror;
-
-/**
- * @typedef {{scope: string}}
- */
-var RegistrationOptions;
-
-/** @type {!ServiceWorkerContainer} */
-Navigator.prototype.serviceWorker;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-global-scope-interface
- * @interface
- * @extends {WorkerGlobalScope}
- */
-function ServiceWorkerGlobalScope() {}
-
-/** @type {!Cache} */
-ServiceWorkerGlobalScope.prototype.scriptCache;
-
-/** @type {!CacheStorage} */
-ServiceWorkerGlobalScope.prototype.caches;
-
-/** @type {!ServiceWorkerClients} */
-ServiceWorkerGlobalScope.prototype.clients;
-
-/** @type {string} */
-ServiceWorkerGlobalScope.prototype.scope;
-
-/** @type {!ServiceWorkerRegistration} */
-ServiceWorkerGlobalScope.prototype.registration;
-
-/** @return {!Promise<void>} */
-ServiceWorkerGlobalScope.prototype.skipWaiting = function() {};
-
-/** @type {!Console} */
-ServiceWorkerGlobalScope.prototype.console;
-
-/** @type {?function(!InstallEvent)} */
-ServiceWorkerGlobalScope.prototype.oninstall;
-
-/** @type {?function(!ExtendableEvent)} */
-ServiceWorkerGlobalScope.prototype.onactivate;
-
-/** @type {?function(!FetchEvent)} */
-ServiceWorkerGlobalScope.prototype.onfetch;
-
-/**
- * TODO(user): This handler should get a custom event in the future.
- * @type {?function(!Event)}
- */
-ServiceWorkerGlobalScope.prototype.onbeforeevicted;
-
-/**
- * TODO(user): This handler should get a custom event in the future.
- * @type {?function(!Event)}
- */
-ServiceWorkerGlobalScope.prototype.onevicted;
-
-/** @type {?function(!MessageEvent)} */
-ServiceWorkerGlobalScope.prototype.onmessage;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-client-interface
- * @constructor
- */
-function ServiceWorkerClient() {}
-
-/** @type {!Promise<void>} */
-ServiceWorkerClient.prototype.ready;
-
-/** @type {boolean} */
-ServiceWorkerClient.prototype.hidden;
-
-/** @type {boolean} */
-ServiceWorkerClient.prototype.focused;
-
-/** @type {VisibilityState} */
-ServiceWorkerClient.prototype.visibilityState;
-
-/** @type {string} */
-ServiceWorkerClient.prototype.url;
-
-/**
- * // TODO(user): Possibly replace the type with enum ContextFrameType once
- * the enum is defined.
- * @type {string}
- */
-ServiceWorkerClient.prototype.frameType;
-
-/**
- * @param {*} message
- * @param {(!Array<!Transferable>|undefined)=} opt_transfer
- */
-ServiceWorkerClient.prototype.postMessage = function(message, opt_transfer) {};
-
-/** @return {!Promise} */
-ServiceWorkerClient.prototype.focus = function() {};
-
-/**
- * @see http://www.w3.org/TR/service-workers/#service-worker-clients-interface
- * @interface
- */
-function ServiceWorkerClients() {}
-
-/**
- * Deprecated in Chrome M43+, use matchAll instead. Reference:
- * https://github.com/slightlyoff/ServiceWorker/issues/610.
- * TODO(user): Remove when getAll is fully deprecated.
- * @param {ServiceWorkerClientQueryOptions=} opt_options
- * @return {!Promise<!Array<!ServiceWorkerClient>>}
- */
-ServiceWorkerClients.prototype.getAll = function(opt_options) {};
-
-/**
- * @param {ServiceWorkerClientQueryOptions=} opt_options
- * @return {!Promise<!Array<!ServiceWorkerClient>>}
- */
-ServiceWorkerClients.prototype.matchAll = function(opt_options) {};
-
-/**
- * @return {!Promise<void>}
- */
-ServiceWorkerClients.prototype.claim = function() {};
-
-/**
- * @param {string} url
- * @return {!Promise<!ServiceWorkerClient>}
- */
-ServiceWorkerClients.prototype.openWindow = function(url) {};
-
-/** @typedef {{includeUncontrolled: (boolean|undefined)}} */
-var ServiceWorkerClientQueryOptions;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#cache-interface
- * @interface
- */
-function Cache() {}
-
-/**
- * @param {!RequestInfo} request
- * @param {CacheQueryOptions=} opt_options
- * @return {!Promise<!Response|undefined>}
- */
-Cache.prototype.match = function(request, opt_options) {};
-
-/**
- * @param {RequestInfo=} opt_request
- * @param {CacheQueryOptions=} opt_options
- * @return {!Promise<!Array<!Response>>}
- */
-Cache.prototype.matchAll = function(opt_request, opt_options) {};
-
-/**
- * @param {!RequestInfo} request
- * @return {!Promise<void>}
- */
-Cache.prototype.add = function(request) {};
-
-/**
- * @param {!Array<!RequestInfo>} requests
- * @return {!Promise<void>}
- */
-Cache.prototype.addAll = function(requests) {};
-
-/**
- * @param {!RequestInfo} request
- * @param {!Response} response
- * @return {!Promise<void>}
- */
-Cache.prototype.put = function(request, response) {};
-
-/**
- * @param {!RequestInfo} request
- * @param {CacheQueryOptions=} opt_options
- * @return {!Promise<boolean>}
- */
-Cache.prototype.delete = function(request, opt_options) {};
-
-/**
- * @param {RequestInfo=} opt_request
- * @param {CacheQueryOptions=} opt_options
- * @return {!Promise<!Array<!Response>>}
- */
-Cache.prototype.keys = function(opt_request, opt_options) {};
-
-/**
- * @typedef {{
- *   ignoreSearch: (boolean|undefined),
- *   ignoreMethod: (boolean|undefined),
- *   ignoreVary: (boolean|undefined),
- *   prefixMatch: (boolean|undefined),
- *   cacheName: (string|undefined)
- * }}
- */
-var CacheQueryOptions;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#cache-storage-interface
- * @interface
- */
-function CacheStorage() {}
-
-/**
- * @param {!RequestInfo} request
- * @param {CacheQueryOptions=} opt_options
- * @return {!Promise<!Response|undefined>}
- */
-CacheStorage.prototype.match = function(request, opt_options) {};
-
-/**
- * @param {string} cacheName
- * @return {!Promise<boolean>}
- */
-CacheStorage.prototype.has = function(cacheName) {};
-
-/**
- * @param {string} cacheName
- * @return {!Promise<!Cache>}
- */
-CacheStorage.prototype.open = function(cacheName) {};
-
-/**
- * @param {string} cacheName
- * @return {!Promise<boolean>}
- */
-CacheStorage.prototype.delete = function(cacheName) {};
-
-/** @return {!Promise<!Array<string>>} */
-CacheStorage.prototype.keys = function() {};
-
-/**
- * @see http://www.w3.org/TR/service-workers/#extendable-event-interface
- * @constructor
- * @param {string} type
- * @param {ExtendableEventInit=} opt_eventInitDict
- * @extends {Event}
- */
-function ExtendableEvent(type, opt_eventInitDict) {}
-
-/** @param {Promise} f */
-ExtendableEvent.prototype.waitUntil = function(f) {};
-
-/**
- * @typedef {{
- *   bubbles: (boolean|undefined),
- *   cancelable: (boolean|undefined)
- * }}
- */
-var ExtendableEventInit;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#install-event-interface
- * @constructor
- * @param {string} type
- * @param {InstallEventInit=} opt_eventInitDict
- * @extends {ExtendableEvent}
- */
-function InstallEvent(type, opt_eventInitDict) {}
-
-/** @type {ServiceWorker} */
-ExtendableEvent.prototype.activeWorker;
-
-/**
- * @typedef {{
- *   bubbles: (boolean|undefined),
- *   cancelable: (boolean|undefined),
- *   activeWorker: (!ServiceWorker|undefined)
- * }}
- */
-var InstallEventInit;
-
-/**
- * @see http://www.w3.org/TR/service-workers/#fetch-event-interface
- * @constructor
- * @param {string} type
- * @param {FetchEventInit=} opt_eventInitDict
- * @extends {Event}
- */
-function FetchEvent(type, opt_eventInitDict) {}
-
-/** @type {!Request} */
-FetchEvent.prototype.request;
-
-/** @type {!ServiceWorkerClient} */
-FetchEvent.prototype.client;
-
-/** @type {!boolean} */
-FetchEvent.prototype.isReload;
-
-/**
- * @param {(Response|Promise<Response>)} r
- */
-FetchEvent.prototype.respondWith = function(r) {};
-
-/**
- * @param {string} url
- * @return {!Promise<!Response>}
- */
-FetchEvent.prototype.forwardTo = function(url) {};
-
-/**
- * @return {!Promise<!Response>}
- */
-FetchEvent.prototype.default = function() {};
-
-/**
- * @typedef {{
- *   bubbles: (boolean|undefined),
- *   cancelable: (boolean|undefined),
- *   request: (!Request|undefined),
- *   client: (!ServiceWorkerClient|undefined),
- *   isReload: (!boolean|undefined)
- * }}
- */
-var FetchEventInit;
diff --git a/externs/w3c_xml.js b/externs/w3c_xml.js
index 8bb855b50..7dadd2426 100644
--- a/externs/w3c_xml.js
+++ b/externs/w3c_xml.js
@@ -413,6 +413,5 @@ function FormData(opt_form) {}
 /**
  * @param {string} name
  * @param {Blob|string} value
- * @param {string=} opt_filename
  */
-FormData.prototype.append = function(name, value, opt_filename) {};
+FormData.prototype.append = function(name, value) {};
diff --git a/externs/webgl.js b/externs/webgl.js
index 31dd1aee5..1acfa458e 100644
--- a/externs/webgl.js
+++ b/externs/webgl.js
@@ -2833,15 +2833,6 @@ WebGLContextAttributes.prototype.premultipliedAlpha;
  */
 WebGLContextAttributes.prototype.preserveDrawingBuffer;
 
-/**
- * @type {boolean}
- */
-WebGLContextAttributes.prototype.preferLowPowerToHighPerformance;
-
-/**
- * @type {boolean}
- */
-WebGLContextAttributes.prototype.failIfMajorPerformanceCaveat;
 
 /**
  * @param {string} eventType
diff --git a/externs/webkit_notifications.js b/externs/webkit_notifications.js
index d99588b84..30e4a0bc7 100644
--- a/externs/webkit_notifications.js
+++ b/externs/webkit_notifications.js
@@ -199,16 +199,3 @@ NotificationCenter.prototype.requestPermission = function(opt_callback) {};
  * @type {NotificationCenter}
  */
 Window.prototype.webkitNotifications;
-
-
-/**
- * @see https://notifications.spec.whatwg.org/#notificationevent
- * @constructor
- * @param {string} type
- * @param {!ExtendableEventInit=} opt_eventInitDict
- * @extends {ExtendableEvent}
- */
-function NotificationEvent(type, opt_eventInitDict) {}
-
-/** @type {?Notification} */
-NotificationEvent.prototype.notification;
diff --git a/src/com/google/javascript/jscomp/CheckRequiresForConstructors.java b/src/com/google/javascript/jscomp/CheckRequiresForConstructors.java
index e64f58c88..63fbdcf08 100644
--- a/src/com/google/javascript/jscomp/CheckRequiresForConstructors.java
+++ b/src/com/google/javascript/jscomp/CheckRequiresForConstructors.java
@@ -379,23 +379,10 @@ class CheckRequiresForConstructors implements HotSwapCompilerPass {
       Visitor visitor = new Visitor() {
         public void visit(Node typeNode) {
           if (typeNode.isString()) {
-            String typeString = typeNode.getString();
-            String rootName = Splitter.on('.').split(typeString).iterator().next();
+            String rootName = Splitter.on('.').split(typeNode.getString()).iterator().next();
             TypedVar var = t.getTypedScope().getVar(rootName);
             if (var == null || !var.isExtern()) {
-              usagesMap.put(typeString, n);
-
-              // Regardless of whether we're adding a weak or strong usage here, add weak usages for
-              // the prefixes of the namespace, like we do for GETPROP nodes. Otherwise we get an
-              // extra require warning for cases like:
-              //
-              //     goog.require('foo.bar.SomeService');
-              //
-              //     /** @constructor @extends {foo.bar.SomeService.Handler} */
-              //     var MyHandler = function() {};
-              Node getprop = NodeUtil.newQName(compiler, typeString);
-              getprop.useSourceInfoIfMissingFromForTree(typeNode);
-              visitGetProp(getprop);
+              usagesMap.put(typeNode.getString(), n);
             }
           }
         }
diff --git a/src/com/google/javascript/jscomp/CommandLineRunner.java b/src/com/google/javascript/jscomp/CommandLineRunner.java
index d798603f2..ce7f70ce9 100644
--- a/src/com/google/javascript/jscomp/CommandLineRunner.java
+++ b/src/com/google/javascript/jscomp/CommandLineRunner.java
@@ -595,7 +595,7 @@ public class CommandLineRunner extends
     private List<String> conformanceConfigs = new ArrayList<>();
 
     @Argument
-    private List<String> arguments = new ArrayList<>();
+    private final List<String> arguments = new ArrayList<>();
     private final CmdLineParser parser;
 
     private static final Map<String, CompilationLevel> COMPILATION_LEVEL_MAP =
@@ -1279,7 +1279,6 @@ public class CommandLineRunner extends
     "chrome.js",
 
     "deprecated.js",
-    "fetchapi.js",
     "fileapi.js",
     "flash.js",
     "gecko_xml.js",
@@ -1302,7 +1301,6 @@ public class CommandLineRunner extends
     "w3c_range.js",
     "w3c_rtc.js",
     "w3c_selectors.js",
-    "w3c_serviceworker.js",
     "w3c_webcrypto.js",
     "w3c_xml.js",
     "window.js",
diff --git a/src/com/google/javascript/jscomp/DefaultPassConfig.java b/src/com/google/javascript/jscomp/DefaultPassConfig.java
index 9e5a6fa7c..25858f527 100644
--- a/src/com/google/javascript/jscomp/DefaultPassConfig.java
+++ b/src/com/google/javascript/jscomp/DefaultPassConfig.java
@@ -207,16 +207,6 @@ public final class DefaultPassConfig extends PassConfig {
       checks.add(closureRewriteModule);
     }
 
-    // ES6 compatible passes.
-
-    if (!options.transpileOnly) {
-      if (options.declaredGlobalExternsOnWindow) {
-        checks.add(declaredGlobalExternsOnWindow);
-      }
-    }
-
-    // ES6 transpilation passes.
-
     if (options.lowerFromEs6() || options.aggressiveVarCheck.isOn()) {
       checks.add(checkVariableReferences);
     }
@@ -257,7 +247,9 @@ public final class DefaultPassConfig extends PassConfig {
 
     checks.add(convertStaticInheritance);
 
-    // End of ES6 transpilation passes.
+    if (options.declaredGlobalExternsOnWindow) {
+      checks.add(declaredGlobalExternsOnWindow);
+    }
 
     if (options.closurePass) {
       checks.add(closureGoogScopeAliases);
diff --git a/src/com/google/javascript/jscomp/ES6ModuleLoader.java b/src/com/google/javascript/jscomp/ES6ModuleLoader.java
index 850e59e25..a12210416 100644
--- a/src/com/google/javascript/jscomp/ES6ModuleLoader.java
+++ b/src/com/google/javascript/jscomp/ES6ModuleLoader.java
@@ -28,7 +28,7 @@ import java.util.Map;
  * @see Section 26.3.3.18.2 of the ES6 spec
  * @see http://wiki.commonjs.org/wiki/Modules/1.1
  */
-class ES6ModuleLoader {
+public final class ES6ModuleLoader {
   /**
    * According to the spec, the forward slash should be the delimiter on all
    * platforms.
@@ -57,7 +57,14 @@ class ES6ModuleLoader {
   private final URI moduleRootURI;
   private final AbstractCompiler compiler;
 
-  ES6ModuleLoader(AbstractCompiler compiler, String moduleRoot) {
+  /**
+   * Creates an instance of the module loader which can be used to locate
+   * ES6 and CommonJS modules.
+   *
+   * @param compiler The compiler
+   * @param moduleRoot Path to a directory which can be used to locate modules
+   */
+  public ES6ModuleLoader(AbstractCompiler compiler, String moduleRoot) {
     this.moduleRoot = moduleRoot;
     this.moduleRootURI = createUri(moduleRoot);
     this.compiler = compiler;
diff --git a/src/com/google/javascript/jscomp/GenerateExports.java b/src/com/google/javascript/jscomp/GenerateExports.java
index bfab82e5a..036ad7e1a 100644
--- a/src/com/google/javascript/jscomp/GenerateExports.java
+++ b/src/com/google/javascript/jscomp/GenerateExports.java
@@ -110,7 +110,7 @@ class GenerateExports implements CompilerPass {
     }
 
     boolean useExportSymbol = true;
-    if (grandparent != null) {
+    if (grandparent != null && exports.containsKey(grandparent)) {
       // grandparent is only set for properties exported off a prototype obj.
       useExportSymbol = false;
     } else if (parent != null && exports.containsKey(parent)) {
diff --git a/src/com/google/javascript/jscomp/GlobalTypeInfo.java b/src/com/google/javascript/jscomp/GlobalTypeInfo.java
index ff40e1e69..963214cbf 100644
--- a/src/com/google/javascript/jscomp/GlobalTypeInfo.java
+++ b/src/com/google/javascript/jscomp/GlobalTypeInfo.java
@@ -659,7 +659,7 @@ class GlobalTypeInfo implements CompilerPass {
         Preconditions.checkState(qnameNode.getParent().isAssign());
         qnameNode.getParent().putBooleanProp(Node.ANALYZED_DURING_GTI, true);
       }
-      currentScope.addNamespace(qnameNode, qnameNode.isFromExterns());
+      currentScope.addNamespace(qnameNode);
     }
 
     private void visitTypedef(Node qnameNode) {
@@ -1063,7 +1063,8 @@ class GlobalTypeInfo implements CompilerPass {
                 if (isConst && !mayWarnAboutNoInit(n) && declType == null) {
                   declType = inferConstTypeFromRhs(n);
                 }
-                currentScope.addLocal(name, declType, isConst, n.isFromExterns());
+                currentScope.addLocal(
+                    name, declType, isConst, n.isFromExterns());
               }
             }
           } else if (currentScope.isOuterVarEarly(name)) {
@@ -2209,16 +2210,10 @@ class GlobalTypeInfo implements CompilerPass {
       }
     }
 
-    private void addNamespace(Node qnameNode, boolean isFromExterns) {
+    private void addNamespace(Node qnameNode) {
       Preconditions.checkArgument(!isNamespace(qnameNode));
       if (qnameNode.isName()) {
         localNamespaces.put(qnameNode.getString(), new NamespaceLit());
-        if (isFromExterns) {
-          // We don't know the full type of a namespace until after we see all
-          // its properties. But we want to add it to the externs, otherwise it
-          // is treated as a local and initialized to the wrong thing in NTI.
-          externs.put(qnameNode.getString(), null);
-        }
       } else {
         QualifiedName qname = QualifiedName.fromNode(qnameNode);
         Namespace ns = getNamespace(qname.getLeftmostName());
@@ -2405,13 +2400,7 @@ class GlobalTypeInfo implements CompilerPass {
       // For now, we put types of namespaces directly into the locals.
       // Alternatively, we could move this into NewTypeInference.initEdgeEnvs
       for (Map.Entry<String, NamespaceLit> entry : localNamespaces.entrySet()) {
-        String name = entry.getKey();
-        JSType t = entry.getValue().toJSType();
-        if (externs.containsKey(name)) {
-          externs.put(name, t);
-        } else {
-          locals.put(name, t);
-        }
+        locals.put(entry.getKey(), entry.getValue().toJSType());
       }
       for (Map.Entry<String, EnumType> entry : localEnums.entrySet()) {
         locals.put(entry.getKey(), entry.getValue().toJSType());
diff --git a/src/com/google/javascript/jscomp/IdMappingUtil.java b/src/com/google/javascript/jscomp/IdMappingUtil.java
index 1451bf9be..0d5b6a6dd 100644
--- a/src/com/google/javascript/jscomp/IdMappingUtil.java
+++ b/src/com/google/javascript/jscomp/IdMappingUtil.java
@@ -28,6 +28,7 @@ import java.util.Map;
 
 /**
  * A utility class for generating and parsing id mappings held by {@link ReplaceIdGenerators}.
+ *
  */
 public final class IdMappingUtil {
 
@@ -36,9 +37,6 @@ public final class IdMappingUtil {
 
   private static final Splitter LINE_SPLITTER = Splitter.on(NEW_LINE).omitEmptyStrings();
 
-  // Prevent instantiation.
-  private IdMappingUtil() {}
-
   /**
    * @return The serialize map of generators and their ids and their
    *     replacements.
diff --git a/src/com/google/javascript/jscomp/NewTypeInference.java b/src/com/google/javascript/jscomp/NewTypeInference.java
index 2f6abd788..603e5347d 100644
--- a/src/com/google/javascript/jscomp/NewTypeInference.java
+++ b/src/com/google/javascript/jscomp/NewTypeInference.java
@@ -273,7 +273,6 @@ final class NewTypeInference implements CompilerPass {
   private static final String RETVAL_ID = "%return";
   // Used for typing the elements of the arguments array
   private static final String ARGSARRAYELM_ID = "%arguments_elm";
-  private static final String THIS_ID = "this";
   private static final String GETTER_PREFIX = "%getter_fun";
   private static final String SETTER_PREFIX = "%setter_fun";
   private final String ABSTRACT_METHOD_NAME;
@@ -427,7 +426,7 @@ final class NewTypeInference implements CompilerPass {
       nonLocals.addAll(currentScope.getOuterVars());
       nonLocals.addAll(currentScope.getFormals());
       if (currentScope.hasThis()) {
-        nonLocals.add(THIS_ID);
+        nonLocals.add("this");
       }
       entryEnv = envPutType(entryEnv, RETVAL_ID, JSType.UNDEFINED);
     } else {
@@ -474,7 +473,7 @@ final class NewTypeInference implements CompilerPass {
       }
       varNames.addAll(currentScope.getFormals());
       if (currentScope.hasThis()) {
-        varNames.add(THIS_ID);
+        varNames.add("this");
       }
       // In the rare case when there is a local variable named "arguments",
       // this entry will be overwritten in the foreach loop below.
@@ -831,7 +830,8 @@ final class NewTypeInference implements CompilerPass {
             break;
           }
           conditional = true;
-          analyzeConditionalStmFwd(dn, NodeUtil.getConditionExpression(n), inEnv);
+          analyzeConditionalStmFwd(
+              dn, NodeUtil.getConditionExpression(n), inEnv);
           break;
         case Token.CASE: {
           conditional = true;
@@ -870,8 +870,11 @@ final class NewTypeInference implements CompilerPass {
     }
   }
 
+  // TODO(dimvar): differentiate for/in to not treat its cond as boolean, but
+  // as an assignment to a string.
   private void analyzeConditionalStmFwd(
-      DiGraphNode<Node, ControlFlowGraph.Branch> stm, Node cond, TypeEnv inEnv) {
+      DiGraphNode<Node, ControlFlowGraph.Branch> stm,
+      Node cond, TypeEnv inEnv) {
     for (DiGraphEdge<Node, ControlFlowGraph.Branch> outEdge :
         stm.getOutEdges()) {
       JSType specializedType;
@@ -1115,13 +1118,8 @@ final class NewTypeInference implements CompilerPass {
           warnings.add(JSError.make(expr, CheckGlobalThis.GLOBAL_THIS));
           resultPair = new EnvTypePair(inEnv, JSType.UNKNOWN);
         } else {
-          // A trimmed-down version of analyzeNameFwd.
-          JSType inferredType = envGetType(inEnv, THIS_ID);
-          if (!inferredType.isSubtypeOf(requiredType)) {
-            return new EnvTypePair(inEnv, inferredType);
-          }
-          JSType preciseType = inferredType.specialize(specializedType);
-          resultPair = EnvTypePair.addBinding(inEnv, THIS_ID, preciseType);
+          JSType thisType = currentScope.getDeclaredTypeOf("this");
+          resultPair = new EnvTypePair(inEnv, thisType);
         }
         break;
       }
@@ -1315,7 +1313,8 @@ final class NewTypeInference implements CompilerPass {
       // We have a heuristic check to avoid the spurious warnings,
       // but we also miss some true warnings.
       JSType declType = currentScope.getDeclaredTypeOf(varName);
-      if (tightenTypeAndDontWarn(varName, expr, declType, inferredType, requiredType)) {
+      if (tightenTypeAndDontWarn(
+          varName, declType, inferredType, requiredType)) {
         inferredType = inferredType.specialize(requiredType);
       } else {
         // Propagate incorrect type so that the context catches
@@ -2433,11 +2432,9 @@ final class NewTypeInference implements CompilerPass {
   }
 
   private boolean tightenTypeAndDontWarn(
-      String varName, Node n, JSType declared, JSType inferred, JSType required) {
-    boolean isSpecializableTop = declared != null && declared.isTop()
-        && (!inferred.isTop() || NodeUtil.isPropertyTest(compiler, n.getParent()));
-    boolean fuzzyDeclaration = declared == null || declared.isUnknown() || isSpecializableTop;
-
+      String varName, JSType declared, JSType inferred, JSType required) {
+    boolean fuzzyDeclaration = declared == null || declared.isUnknown() ||
+        (declared.isTop() && !inferred.isTop());
     return fuzzyDeclaration
         // The intent is to be looser about warnings in the case when a value
         // is passed to a function (as opposed to being created locally),
@@ -2541,7 +2538,7 @@ final class NewTypeInference implements CompilerPass {
 
     // First, analyze the receiver object.
     if (specializedType.isTruthy() || specializedType.isFalsy()) {
-      recvReqType = reqObjType;
+      recvReqType = JSType.UNKNOWN;
       recvSpecType = reqObjType.withProperty(propQname, requiredType);
     } else {
       recvReqType = reqObjType.withProperty(propQname, requiredType);
@@ -2591,7 +2588,6 @@ final class NewTypeInference implements CompilerPass {
           !resultType.isSubtypeOf(requiredType) &&
           tightenTypeAndDontWarn(
               receiver.isName() ? receiver.getString() : null,
-              receiver,
               recvType.getDeclaredProp(propQname),
               resultType, requiredType)) {
         // Tighten the inferred type and don't warn.
@@ -2737,7 +2733,7 @@ final class NewTypeInference implements CompilerPass {
         if (!currentScope.hasThis()) {
           return new EnvTypePair(outEnv, JSType.UNKNOWN);
         }
-        JSType thisType = currentScope.getDeclaredTypeOf(THIS_ID);
+        JSType thisType = currentScope.getDeclaredTypeOf("this");
         return new EnvTypePair(outEnv, thisType);
       }
       case Token.NAME:
@@ -3410,9 +3406,9 @@ final class NewTypeInference implements CompilerPass {
     switch (expr.getType()) {
       case Token.THIS: {
         if (currentScope.hasThis()) {
-          lvalResult = new LValueResultFwd(inEnv, envGetType(inEnv, THIS_ID),
-              currentScope.getDeclaredTypeOf(THIS_ID),
-              new QualifiedName(THIS_ID));
+          lvalResult = new LValueResultFwd(inEnv, envGetType(inEnv, "this"),
+              currentScope.getDeclaredTypeOf("this"),
+              new QualifiedName("this"));
         } else {
           warnings.add(JSError.make(expr, CheckGlobalThis.GLOBAL_THIS));
           lvalResult = new LValueResultFwd(inEnv, JSType.UNKNOWN, null, null);
diff --git a/src/com/google/javascript/jscomp/NodeUtil.java b/src/com/google/javascript/jscomp/NodeUtil.java
index 0df89b90b..539a3b1e4 100644
--- a/src/com/google/javascript/jscomp/NodeUtil.java
+++ b/src/com/google/javascript/jscomp/NodeUtil.java
@@ -2710,7 +2710,7 @@ public final class NodeUtil {
    * Creates a node representing a qualified name.
    *
    * @param name A qualified name (e.g. "foo" or "foo.bar.baz")
-   * @return A VAR node, or an EXPR_RESULT node containing an ASSIGN or NAME node.
+   * @return A NAME or GETPROP node
    */
   public static Node newQNameDeclaration(
       AbstractCompiler compiler, String name, Node value, JSDocInfo info) {
diff --git a/src/com/google/javascript/jscomp/PolymerPass.java b/src/com/google/javascript/jscomp/PolymerPass.java
index f829961ad..01bb770c4 100644
--- a/src/com/google/javascript/jscomp/PolymerPass.java
+++ b/src/com/google/javascript/jscomp/PolymerPass.java
@@ -306,7 +306,7 @@ final class PolymerPass extends AbstractPostOrderCallback implements HotSwapComp
       }
 
       Name behaviorGlobalName = globalNames.getSlot(behaviorName.getQualifiedName());
-      if (behaviorGlobalName == null || behaviorGlobalName.getDeclaration() == null) {
+      if (behaviorGlobalName == null) {
         compiler.report(JSError.make(behaviorName, POLYMER_UNQUALIFIED_BEHAVIOR));
         continue;
       }
diff --git a/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java b/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
index 38278d590..2e0dccc92 100644
--- a/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
+++ b/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
@@ -222,7 +222,7 @@ class ProcessClosurePrimitives extends AbstractPostOrderCallback
 
     Node replacement = NodeUtil.newQNameDeclaration(
         compiler, name, value, n.getJSDocInfo());
-    replacement.useSourceInfoIfMissingFromForTree(parent);
+    replacement.useSourceInfoIfMissingFromForTree(n);
     parent.getParent().replaceChild(parent, replacement);
     compiler.reportCodeChange();
   }
diff --git a/src/com/google/javascript/jscomp/ProcessCommonJSModules.java b/src/com/google/javascript/jscomp/ProcessCommonJSModules.java
index 8845f74c2..4cbc4100f 100644
--- a/src/com/google/javascript/jscomp/ProcessCommonJSModules.java
+++ b/src/com/google/javascript/jscomp/ProcessCommonJSModules.java
@@ -49,11 +49,30 @@ public final class ProcessCommonJSModules implements CompilerPass {
   private final ES6ModuleLoader loader;
   private final boolean reportDependencies;
 
-  ProcessCommonJSModules(Compiler compiler, ES6ModuleLoader loader) {
+  /**
+   * Creates a new ProcessCommonJSModules instance which can be used to
+   * rewrite CommonJS modules to a concatenable form.
+   *
+   * @param compiler The compiler
+   * @param loader The module loader which is used to locate CommonJS modules
+   */
+  public ProcessCommonJSModules(Compiler compiler, ES6ModuleLoader loader) {
     this(compiler, loader, true);
   }
 
-  ProcessCommonJSModules(Compiler compiler, ES6ModuleLoader loader,
+  /**
+   * Creates a new ProcessCommonJSModules instance which can be used to
+   * rewrite CommonJS modules to a concatenable form.
+   *
+   * @param compiler The compiler
+   * @param loader The module loader which is used to locate CommonJS modules
+   * @param reportDependencies Whether the rewriter should report dependency
+   *     information to the Closure dependency manager. This needs to be true
+   *     if we want to sort CommonJS module inputs correctly. Note that goog.provide
+   *     and goog.require calls will still be generated if this argument is
+   *     false.
+   */
+  public ProcessCommonJSModules(Compiler compiler, ES6ModuleLoader loader,
       boolean reportDependencies) {
     this.compiler = compiler;
     this.loader = loader;
diff --git a/src/com/google/javascript/jscomp/ProcessEs6Modules.java b/src/com/google/javascript/jscomp/ProcessEs6Modules.java
index 15f371121..140bce36c 100644
--- a/src/com/google/javascript/jscomp/ProcessEs6Modules.java
+++ b/src/com/google/javascript/jscomp/ProcessEs6Modules.java
@@ -58,7 +58,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
   /**
    * Maps exported names to their names in current module.
    */
-  private Map<String, NameNodePair> exportMap = new LinkedHashMap<>();
+  private Map<String, String> exportMap = new LinkedHashMap<>();
 
   /**
    * Maps symbol names to a pair of (moduleName, originalName). The original
@@ -79,13 +79,18 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
   private boolean reportDependencies;
 
   /**
+   * Creates a new ProcessEs6Modules instance which can be used to rewrite
+   * ES6 modules to a concatenable form.
+   *
+   * @param compiler The compiler
+   * @param loader The module loader which is used to locate ES6 modules
    * @param reportDependencies Whether the rewriter should report dependency
    *     information to the Closure dependency manager. This needs to be true
    *     if we want to sort ES6 module inputs correctly. Note that goog.provide
    *     and goog.require calls will still be generated if this argument is
    *     false.
    */
-  ProcessEs6Modules(Compiler compiler, ES6ModuleLoader loader,
+  public ProcessEs6Modules(Compiler compiler, ES6ModuleLoader loader,
       boolean reportDependencies) {
     this.compiler = compiler;
     this.loader = loader;
@@ -206,12 +211,12 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
         Node decl = child.cloneTree();
         decl.setJSDocInfo(export.getJSDocInfo());
         parent.replaceChild(export, decl);
-        exportMap.put("default", new NameNodePair(name, child));
+        exportMap.put("default", name);
       } else {
         Node var = IR.var(IR.name(DEFAULT_EXPORT_NAME), export.removeFirstChild());
         var.useSourceInfoIfMissingFromForTree(export);
         parent.replaceChild(export, var);
-        exportMap.put("default", new NameNodePair(DEFAULT_EXPORT_NAME, child));
+        exportMap.put("default", DEFAULT_EXPORT_NAME);
       }
     } else if (export.getBooleanProp(Node.EXPORT_ALL_FROM)) {
       //   export * from 'moduleIdentifier';
@@ -231,8 +236,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
       for (Node exportSpec : export.getFirstChild().children()) {
         String nameFromOtherModule = exportSpec.getFirstChild().getString();
         String exportedName = exportSpec.getLastChild().getString();
-        exportMap.put(exportedName,
-            new NameNodePair(moduleName + "." + nameFromOtherModule, exportSpec));
+        exportMap.put(exportedName, moduleName + "." + nameFromOtherModule);
       }
       parent.removeChild(export);
     } else {
@@ -244,7 +248,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
               exportSpec.getChildCount() == 2
                   ? exportSpec.getLastChild().getString()
                   : origName.getString(),
-              new NameNodePair(origName.getString(), exportSpec));
+              origName.getString());
         }
         parent.removeChild(export);
       } else {
@@ -264,7 +268,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
           String name = maybeName.getString();
           Var v = t.getScope().getVar(name);
           if (v == null || v.isGlobal()) {
-            exportMap.put(name, new NameNodePair(name, maybeName));
+            exportMap.put(name, name);
           }
 
           // If the declaration declares a new type, create annotations for
@@ -310,10 +314,9 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
       script.addChildToBack(varNode);
     }
 
-    for (Map.Entry<String, NameNodePair> entry : exportMap.entrySet()) {
+    for (Map.Entry<String, String> entry : exportMap.entrySet()) {
       String exportedName = entry.getKey();
-      String withSuffix = entry.getValue().name;
-      Node nodeForSourceInfo = entry.getValue().nodeForSourceInfo;
+      String withSuffix = entry.getValue();
       Node getProp = IR.getprop(IR.name(moduleName), IR.string(exportedName));
 
       if (typedefs.contains(exportedName)) {
@@ -326,7 +329,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
         JSDocInfo info = builder.build();
         getProp.setJSDocInfo(info);
         Node exprResult = IR.exprResult(getProp)
-            .useSourceInfoIfMissingFromForTree(nodeForSourceInfo);
+            .useSourceInfoIfMissingFromForTree(script);
         script.addChildToBack(exprResult);
       } else {
         //   moduleName.foo = foo;
@@ -335,7 +338,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
             getProp,
             NodeUtil.newQName(compiler, withSuffix));
         Node exprResult = IR.exprResult(assign)
-            .useSourceInfoIfMissingFromForTree(nodeForSourceInfo);
+            .useSourceInfoIfMissingFromForTree(script);
         if (classes.contains(exportedName)) {
           JSDocInfoBuilder builder = new JSDocInfoBuilder(true);
           builder.recordConstancy();
@@ -534,7 +537,7 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
     }
   }
 
-  private static class ModuleOriginalNamePair {
+  private class ModuleOriginalNamePair {
     private String module;
     private String originalName;
 
@@ -548,19 +551,4 @@ public final class ProcessEs6Modules extends AbstractPostOrderCallback {
       return "(" + module + ", " + originalName + ")";
     }
   }
-
-  private static class NameNodePair {
-    final String name;
-    final Node nodeForSourceInfo;
-
-    private NameNodePair(String name, Node nodeForSourceInfo) {
-      this.name = name;
-      this.nodeForSourceInfo = nodeForSourceInfo;
-    }
-
-    @Override
-    public String toString() {
-      return "(" + name + ", " + nodeForSourceInfo + ")";
-    }
-  }
 }
diff --git a/src/com/google/javascript/jscomp/deps/ClosureBundler.java b/src/com/google/javascript/jscomp/deps/ClosureBundler.java
index 24dcd9d87..64eac3484 100644
--- a/src/com/google/javascript/jscomp/deps/ClosureBundler.java
+++ b/src/com/google/javascript/jscomp/deps/ClosureBundler.java
@@ -29,6 +29,7 @@ import java.nio.charset.Charset;
 public final class ClosureBundler {
   private boolean useEval = false;
   private String sourceUrl = null;
+  private boolean useStrict = false;
 
   public ClosureBundler() {
   }
@@ -38,6 +39,11 @@ public final class ClosureBundler {
     return this;
   }
 
+  public final ClosureBundler forceStrict(boolean useStrict) {
+    this.useStrict = useStrict;
+    return this;
+  }
+
   public final ClosureBundler withSourceUrl(String sourceUrl) {
     this.sourceUrl = sourceUrl;
     return this;
@@ -83,6 +89,9 @@ public final class ClosureBundler {
       throws IOException {
     if (useEval) {
       out.append("(0,eval(\"");
+      if (useStrict) {
+        appendEscaped(out, "'use strict';");
+      }
       append(out, Mode.ESCAPED, contents);
       appendSourceUrl(out, Mode.ESCAPED);
       out.append("\"));");
diff --git a/src/com/google/javascript/jscomp/newtypes/FunctionType.java b/src/com/google/javascript/jscomp/newtypes/FunctionType.java
index f65f50831..e2e8feab1 100644
--- a/src/com/google/javascript/jscomp/newtypes/FunctionType.java
+++ b/src/com/google/javascript/jscomp/newtypes/FunctionType.java
@@ -177,9 +177,9 @@ public final class FunctionType {
   private static final FunctionType LOOSE_TOP_FUNCTION = new FunctionType(true);
 
   // Corresponds to Function, which is a subtype and supertype of all functions.
-  static final FunctionType QMARK_FUNCTION = normalized(null,
+  static final FunctionType QMARK_FUNCTION = FunctionType.normalized(null,
       null, JSType.UNKNOWN, JSType.UNKNOWN, null, null, null, null, true);
-  private static final FunctionType BOTTOM_FUNCTION = normalized(
+  private static final FunctionType BOTTOM_FUNCTION = FunctionType.normalized(
       null, null, null, JSType.BOTTOM, null, null, null, null, false);
 
   public boolean isTopFunction() {
@@ -305,7 +305,7 @@ public final class FunctionType {
     if (isQmarkFunction()) {
       return FunctionTypeBuilder.qmarkFunctionBuilder().buildDeclaration();
     }
-    Preconditions.checkState(!isLoose(), "Loose function: %s", this);
+    Preconditions.checkState(!isLoose());
     // Don't do it for generic types.
     if (isGeneric()) {
       return null;
@@ -445,14 +445,12 @@ public final class FunctionType {
       return f2;
     } else if (f2 == null || f1.equals(f2)) {
       return f1;
-    } else if (f1.isQmarkFunction() || f2.isQmarkFunction()) {
-      return QMARK_FUNCTION;
     } else if (f1.isTopFunction() || f2.isTopFunction()) {
       return TOP_FUNCTION;
     }
 
     if (f1.isLoose() || f2.isLoose()) {
-      return looseJoin(f1, f2);
+      return FunctionType.looseJoin(f1, f2);
     }
 
     if (f1.isGeneric() && f2.isSubtypeOf(f1)) {
@@ -503,7 +501,7 @@ public final class FunctionType {
         || !this.isLoose() && other.isLoose()) {
       return this;
     }
-    FunctionType result = meet(this, other);
+    FunctionType result = FunctionType.meet(this, other);
     if (this.isLoose() && !result.isLoose()) {
       result = result.withLoose();
     }
@@ -521,7 +519,7 @@ public final class FunctionType {
 
     // War is peace, freedom is slavery, meet is join
     if (f1.isLoose() || f2.isLoose()) {
-      return looseJoin(f1, f2);
+      return FunctionType.looseJoin(f1, f2);
     }
 
     if (f1.isGeneric() && f1.isSubtypeOf(f2)) {
diff --git a/src/com/google/javascript/jscomp/newtypes/NominalType.java b/src/com/google/javascript/jscomp/newtypes/NominalType.java
index 8875afbcf..f959a09f7 100644
--- a/src/com/google/javascript/jscomp/newtypes/NominalType.java
+++ b/src/com/google/javascript/jscomp/newtypes/NominalType.java
@@ -249,21 +249,51 @@ public final class NominalType {
   }
 
   boolean isSubtypeOf(NominalType other) {
-    RawNominalType thisRaw = this.rawType;
-    if (thisRaw == other.rawType) {
-      return areTypeParametersSubtypes(other);
+    RawNominalType otherRawType = other.rawType;
+
+    // interface <: class
+    if (rawType.isInterface && !otherRawType.isInterface) {
+      return false;
     }
-    if (other.isInterface()) {
-      // If thisRaw is not finalized, thisRaw.interfaces may be null.
-      for (NominalType i : thisRaw.getInterfaces()) {
-        if (i.instantiateGenerics(this.typeMap).isSubtypeOf(other)) {
+
+    // class <: interface
+    if (!rawType.isInterface && otherRawType.isInterface) {
+      if (rawType.interfaces == null) {
+        return false;
+      }
+      for (NominalType i : rawType.interfaces) {
+        if (i.instantiateGenerics(typeMap).isSubtypeOf(other)) {
           return true;
         }
       }
+      return false;
+    }
+
+    // interface <: interface
+    if (rawType.isInterface && otherRawType.isInterface) {
+      if (rawType.equals(otherRawType)) {
+        return areTypeParametersSubtypes(other);
+      } else if (rawType.interfaces == null) {
+        return false;
+      } else {
+        for (NominalType i : rawType.interfaces) {
+          if (i.instantiateGenerics(typeMap).isSubtypeOf(other)) {
+            return true;
+          }
+        }
+        return false;
+      }
+    }
+
+    // class <: class
+    if (rawType.equals(otherRawType)) {
+      return areTypeParametersSubtypes(other);
+    } else if (rawType.superClass == null) {
+      return false;
+    } else {
+      return rawType.superClass.instantiateGenerics(typeMap)
+          .isSubtypeOf(other);
     }
-    // Note that other can still be an interface here (implemented by a superclass)
-    return isClass() && thisRaw.superClass != null
-        && thisRaw.superClass.instantiateGenerics(this.typeMap).isSubtypeOf(other);
   }
 
   private boolean areTypeParametersSubtypes(NominalType other) {
@@ -363,18 +393,20 @@ public final class NominalType {
     if (thisRaw == other.rawType) {
       return this;
     }
-    if (other.isInterface()) {
-      for (NominalType i : thisRaw.interfaces) {
-        NominalType nt = i.instantiateGenerics(this.typeMap).findMatchingAncestorWith(other);
-        if (nt != null) {
-          return nt;
-        }
+    if (isInterface() && other.isClass()) {
+      return null;
+    }
+    if (other.isClass()) {
+      if (thisRaw.superClass == null) {
+        return null;
       }
+      return getInstantiatedSuperclass().findMatchingAncestorWith(other);
     }
-    // Note that other can still be an interface here (implemented by a superclass)
-    if (isClass() && thisRaw.superClass != null) {
-      return thisRaw.superClass.instantiateGenerics(this.typeMap)
-        .findMatchingAncestorWith(other);
+    for (NominalType interf : getInstantiatedInterfaces()) {
+      NominalType nt = interf.findMatchingAncestorWith(other);
+      if (nt != null) {
+        return nt;
+      }
     }
     return null;
   }
@@ -530,6 +562,11 @@ public final class NominalType {
       return objectKind.isDict();
     }
 
+    private boolean isRawSubtypeOf(RawNominalType other) {
+      return other.isClass() ? isClass() && hasAncestorClass(other)
+          : hasAncestorInterface(other);
+    }
+
     ImmutableList<String> getTypeParameters() {
       return typeParameters;
     }
@@ -601,7 +638,7 @@ public final class NominalType {
     }
 
     public ImmutableSet<NominalType> getInterfaces() {
-      return this.interfaces == null ? ImmutableSet.<NominalType>of() : this.interfaces;
+      return this.interfaces;
     }
 
     private Property getOwnProp(String pname) {
diff --git a/src/com/google/javascript/refactoring/SuggestedFix.java b/src/com/google/javascript/refactoring/SuggestedFix.java
index 9626da805..0328923e8 100644
--- a/src/com/google/javascript/refactoring/SuggestedFix.java
+++ b/src/com/google/javascript/refactoring/SuggestedFix.java
@@ -216,7 +216,9 @@ public final class SuggestedFix {
           && parent != null
           && (parent.isScript() || parent.isBlock())) {
         Node previousSibling = parent.getChildBefore(n);
-        if (previousSibling != null) {
+        // TODO(mknichel): There appears to be a bug in goog.define rewriting that sets the
+        // length of the rewritten node to 0.
+        if (previousSibling != null && previousSibling.getLength() > 0) {
           int previousSiblingEndPosition =
               previousSibling.getSourceOffset() + previousSibling.getLength();
           length += (startPosition - previousSiblingEndPosition);
@@ -331,7 +333,7 @@ public final class SuggestedFix {
           n.getSourceFileName(),
           new CodeReplacement(
               jsDoc.getOriginalCommentPosition(),
-              n.getFirstChild().getSourceOffset() - jsDoc.getOriginalCommentPosition(),
+              n.getSourceOffset() - jsDoc.getOriginalCommentPosition() + 1,
               ""));
       replacements.put(
           n.getSourceFileName(),


Test patch:
diff --git a/test/com/google/javascript/jscomp/CommandLineRunnerTest.java b/test/com/google/javascript/jscomp/CommandLineRunnerTest.java
index fa104e4ae..f79c7ea21 100644
--- a/test/com/google/javascript/jscomp/CommandLineRunnerTest.java
+++ b/test/com/google/javascript/jscomp/CommandLineRunnerTest.java
@@ -1198,7 +1198,7 @@ public final class CommandLineRunnerTest extends TestCase {
     args.add("--generate_exports=true");
     test("/** @export */ foo.prototype.x = function() {};",
         "foo.prototype.x=function(){};" +
-        "goog.exportProperty(foo.prototype,\"x\",foo.prototype.x);");
+        "goog.exportSymbol(\"foo.prototype.x\",foo.prototype.x);");
   }
 
   public void testDepreciationWithVerbose() {
diff --git a/test/com/google/javascript/jscomp/ExtraRequireTest.java b/test/com/google/javascript/jscomp/ExtraRequireTest.java
index 8b30da0cf..14decb9b7 100644
--- a/test/com/google/javascript/jscomp/ExtraRequireTest.java
+++ b/test/com/google/javascript/jscomp/ExtraRequireTest.java
@@ -18,8 +18,6 @@ package com.google.javascript.jscomp;
 
 import static com.google.javascript.jscomp.CheckRequiresForConstructors.EXTRA_REQUIRE_WARNING;
 
-import com.google.common.base.Joiner;
-
 /**
  * Tests for the "extra requires" check in {@link CheckRequiresForConstructors}.
  */
@@ -55,16 +53,6 @@ public final class ExtraRequireTest extends CompilerTestCase {
     testSame("goog.require('foo'); foo();");
   }
 
-  public void testNoWarning_InnerClassInExtends() {
-    String js = Joiner.on('\n').join(
-        "var goog = {};",
-        "goog.require('goog.foo.Bar');",
-        "",
-        "/** @constructor @extends {goog.foo.Bar.Inner} */",
-        "function SubClass() {}");
-    testSame(js);
-  }
-
   public void testWarning() {
     testError("goog.require('foo.bar');", EXTRA_REQUIRE_WARNING);
     // The local var "bar" is unused so after goog.scope rewriting, foo.bar is unused.
diff --git a/test/com/google/javascript/jscomp/GenerateExportsTest.java b/test/com/google/javascript/jscomp/GenerateExportsTest.java
index 37b1f1d34..83d5c757f 100644
--- a/test/com/google/javascript/jscomp/GenerateExportsTest.java
+++ b/test/com/google/javascript/jscomp/GenerateExportsTest.java
@@ -74,15 +74,6 @@ public final class GenerateExportsTest extends CompilerTestCase {
          "goog.exportProperty(foo.prototype,\"bar\",foo.prototype.bar)");
   }
 
-  public void testExportPrototypeProperty() {
-    test("function Foo() {}\n" +
-         "/** @export */ Foo.prototype.bar = function() {};",
-
-         "function Foo() {}\n" +
-         "Foo.prototype.bar = function(){};\n" +
-         "goog.exportProperty(Foo.prototype, 'bar', Foo.prototype.bar);");
-  }
-
   public void testExportSymbolAndConstantProperties() {
     test("/** @export */function foo() {}" +
          "/** @export */foo.BAR = 5;",
diff --git a/test/com/google/javascript/jscomp/MissingRequireTest.java b/test/com/google/javascript/jscomp/MissingRequireTest.java
index 1f9772297..0b48bdfc0 100644
--- a/test/com/google/javascript/jscomp/MissingRequireTest.java
+++ b/test/com/google/javascript/jscomp/MissingRequireTest.java
@@ -97,16 +97,6 @@ public final class MissingRequireTest extends CompilerTestCase {
     testSame(js);
   }
 
-  public void testPassWithInnerClassInExtends() {
-    String js = Joiner.on('\n').join(
-        "var goog = {};",
-        "goog.require('goog.foo.Bar');",
-        "",
-        "/** @constructor @extends {goog.foo.Bar.Inner} */",
-        "function SubClass() {}");
-    testSame(js);
-  }
-
   public void testFailWithNestedNewNodes() {
     String[] js =
         new String[] {"var goog = {}; goog.require('goog.foo.Bar'); "
diff --git a/test/com/google/javascript/jscomp/NewTypeInferenceES5OrLowerTest.java b/test/com/google/javascript/jscomp/NewTypeInferenceES5OrLowerTest.java
index 6fd554cc6..9cc725752 100644
--- a/test/com/google/javascript/jscomp/NewTypeInferenceES5OrLowerTest.java
+++ b/test/com/google/javascript/jscomp/NewTypeInferenceES5OrLowerTest.java
@@ -1565,13 +1565,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         + "    g(5, cond);\n"
         + "  }\n"
         + "}");
-
-    typeCheck(
-        "/**\n"
-        + " * @param {function (number)|Function} x\n"
-        + " */\n"
-        + "function f(x) {};\n"
-        + "f(function () {});");
   }
 
   public void testBackwardForwardPathologicalCase2() {
@@ -3477,46 +3470,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         GlobalTypeInfo.INVALID_PROP_OVERRIDE);
   }
 
-  public void testInheritingTheParentClassInterfaces() {
-    typeCheck(
-        "/** @interface */\n"
-        + "function High() {}\n"
-        + "/** @type {number} */\n"
-        + "High.prototype.p = 123;\n"
-        + "/** @constructor @implements {High} */\n"
-        + "function Mid() {}\n"
-        + "Mid.prototype.p = 123;\n"
-        // Low has p from Mid, no warning here
-        + "/** @constructor @extends {Mid} */\n"
-        + "function Low() {}");
-
-    typeCheck(
-        "/** @interface */\n"
-        + "function High() {}\n"
-        + "/** @constructor @implements {High} */\n"
-        + "function Mid() {}\n"
-        + "/** @constructor @extends {Mid} */\n"
-        + "function Low() {}"
-        + "var /** !High */ x = new Low();");
-
-    typeCheck(
-        "/**\n"
-        + " * @interface\n"
-        + " * @template T\n"
-        + " */\n"
-        + "function High() {}\n"
-        + "/**\n"
-        + " * @constructor\n"
-        + " * @template T\n"
-        + " * @implements {High<T>}\n"
-        + " */\n"
-        + "function Mid() {}\n"
-        + "/** @constructor @extends {Mid<number>} */\n"
-        + "function Low() {}\n"
-        + "var /** !High<string> */ x = new Low;",
-        NewTypeInference.MISTYPED_ASSIGN_RHS);
-  }
-
   public void testInheritanceSubtyping() {
     typeCheck("/** @constructor */ function Parent() {}\n"
         + "/** @constructor @extends{Parent} */ function Child() {}\n"
@@ -4403,21 +4356,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         NewTypeInference.MISTYPED_ASSIGN_RHS);
   }
 
-  public void testNamespacesInExterns() {
-    typeCheckCustomExterns(
-        DEFAULT_EXTERNS
-        + "/** @const */ var ns = {};\n"
-        + "/** @type {number} */ ns.num;",
-        "var /** number */ n = ns.num;");
-
-    typeCheckCustomExterns(
-        DEFAULT_EXTERNS
-        + "/** @const */ var ns = {};\n"
-        + "/** @type {number} */ ns.num;",
-        "var /** string */ s = ns.num;",
-        NewTypeInference.MISTYPED_ASSIGN_RHS);
-  }
-
   public void testDontInferNamespaces() {
     typeCheck(
         "/** @const */ var ns = {};\n"
@@ -7704,29 +7642,14 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         + "};");
 
     typeCheck(
-        "/** @constructor */\n"
-        + "function Obj(){}\n"
-        + "/** @constructor */\n"
-        + "var Foo = function() {\n"
-        + "  /** @private {Obj} */ this.obj;\n"
+        "/** @constructor */ function Obj(){}\n"
+        + "/** @constructor */ var Foo = function() {\n"
+        + "    /** @private {Obj} */ this.obj;\n"
         + "};\n"
         + "Foo.prototype.update = function() {\n"
         + "    if (!this.obj.size) {}\n"
         + "};",
         NewTypeInference.NULLABLE_DEREFERENCE);
-
-    typeCheck(
-        "/** @constructor */\n"
-        + "function Obj(){}\n"
-        + "/** @constructor */\n"
-        + "var Foo = function() {\n"
-        + "  /** @private {Obj} */ this.obj;\n"
-        + "};\n"
-        + "/** @param {!Foo} x */\n"
-        + "function f(x) {\n"
-        + "  if (!x.obj.size) {}\n"
-        + "};",
-        NewTypeInference.NULLABLE_DEREFERENCE);
   }
 
   public void testLooseFunctionSubtypeDoesntCrash() {
@@ -9895,20 +9818,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         + "function f(x) {\n"
         + "  return goog.isString(x) && (1 < 2) ? x : 'a';\n"
         + "}");
-
-    typeCheck(CLOSURE_BASE + "/**\n"
-        + " * @param {*} o1\n"
-        + " * @param {*} o2\n"
-        + " * @return {boolean}\n"
-        + " */\n"
-        + "function deepEquals(o1, o2) {\n"
-        + "  if (goog.isObject(o1) && goog.isObject(o2)) {\n"
-        + "    if (o1.length != o2.length) {\n"
-        + "      return true;\n"
-        + "    }\n"
-        + "  }\n"
-        + "  return false;\n"
-        + "}");
   }
 
   public void testGoogIsPredicatesFalse() {
@@ -10664,20 +10573,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         + "}\n"
         + "obj.n - 123;",
         NewTypeInference.INVALID_OPERAND_TYPE);
-
-    typeCheck(
-        "/** @constructor */\n"
-        + "function Foo() {\n"
-        + "  this.a = 123;\n"
-        + "}\n"
-        + "/** @constructor */\n"
-        + "function Bar(x) {\n"
-        + "  /** @type {Foo} */\n"
-        + "  this.b = x;\n"
-        + "  if (this.b != null) {\n"
-        + "    return this.b.a;\n"
-        + "  }\n"
-        + "}");
   }
 
   public void testAutoconvertBoxedNumberToNumber() {
@@ -11300,36 +11195,6 @@ public final class NewTypeInferenceES5OrLowerTest extends NewTypeInferenceTestBa
         + "  var /** string */ s = f(x);\n"
         + "}",
         NewTypeInference.MISTYPED_ASSIGN_RHS);
-
-    typeCheck(
-        "/**\n"
-        + " * @interface\n"
-        + " * @template T\n"
-        + " */\n"
-        + "function High() {}\n"
-        + "/**\n"
-        + " * @constructor\n"
-        + " * @template T\n"
-        + " * @implements {High<T>}\n"
-        + " */\n"
-        + "function Mid() {}\n"
-        + "/**\n"
-        + " * @constructor\n"
-        + " * @template T\n"
-        + " * @extends {Mid<T>}\n"
-        + " * @param {T} x\n"
-        + " */\n"
-        + "function Low(x) {}\n"
-        + "/**\n"
-        + " * @template T\n"
-        + " * @param {!High<T>} x\n"
-        + " * @return {T}\n"
-        + " */\n"
-        + "function f(x) {\n"
-        + "  return /** @type {?} */ (null);\n"
-        + "}\n"
-        + "f(new Low('asdf')) - 5;",
-        NewTypeInference.INVALID_OPERAND_TYPE);
   }
 
   public void testArgumentsArray() {
diff --git a/test/com/google/javascript/jscomp/PolymerPassTest.java b/test/com/google/javascript/jscomp/PolymerPassTest.java
index 993a2ee73..bc456e7f8 100644
--- a/test/com/google/javascript/jscomp/PolymerPassTest.java
+++ b/test/com/google/javascript/jscomp/PolymerPassTest.java
@@ -936,19 +936,6 @@ public class PolymerPassTest extends CompilerTestCase {
         "})();"),
         POLYMER_UNQUALIFIED_BEHAVIOR, true);
 
-    testSame(
-        Joiner.on("\n").join(
-        "var foo = {};",
-        "(function() {",
-        "  Polymer({",
-        "    is: 'x-element',",
-        "    behaviors: [",
-        "      foo.IsNotDefined",
-        "    ],",
-        "  });",
-        "})();"),
-        POLYMER_UNQUALIFIED_BEHAVIOR, true);
-
     testSame(
         Joiner.on("\n").join(
         "Polymer({",
diff --git a/test/com/google/javascript/refactoring/SuggestedFixTest.java b/test/com/google/javascript/refactoring/SuggestedFixTest.java
index 1b705f33c..4421d7bce 100644
--- a/test/com/google/javascript/refactoring/SuggestedFixTest.java
+++ b/test/com/google/javascript/refactoring/SuggestedFixTest.java
@@ -21,7 +21,6 @@ import static com.google.javascript.refactoring.testing.SuggestedFixes.assertRep
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.SetMultimap;
@@ -298,28 +297,6 @@ public class SuggestedFixTest {
     assertChanges(fix, "", input, expectedCode);
   }
 
-  @Test
-  public void testRemoveCast_return() {
-    String input = Joiner.on('\n').join(
-        "function f() {",
-        "  return /** @type {string} */ (",
-        "      'I am obviously a string. Why are you casting me?');",
-        "}");
-    String expectedCode = Joiner.on('\n').join(
-        "function f() {",
-        "  return 'I am obviously a string. Why are you casting me?';",
-        "}");
-    Compiler compiler = getCompiler(input);
-    Node root = compileToScriptRoot(compiler);
-    Node castNode = root.getFirstChild().getLastChild().getFirstChild().getLastChild();
-    assertTrue(castNode.isCast());
-
-    SuggestedFix fix = new SuggestedFix.Builder()
-        .removeCast(castNode, compiler)
-        .build();
-    assertChanges(fix, "", input, expectedCode);
-  }
-
   @Test
   public void testChangeJsDocType() {
     String before = "/** ";