-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RemoveUnusedCode regression in v20180204 #2822
Comments
Were you able to determine what code was unexpectedly removed? |
Compiling with source maps points me to line 1023 which is one of those
https://gist.github.com/thheller/7f43caf785f1846ef6d0cd05a7bcbabc#file-quill-js-L1023 which is called in the constructor a few lines later (1085).
https://gist.github.com/thheller/7f43caf785f1846ef6d0cd05a7bcbabc#file-quill-js-L1085 Note that the gist is not original quill.js. It is the raw input generated by shadow-cljs when passing it to the closure compiler. Not that it matters since the error occurs without that. I was not able to identify what code exactly was removed/changed. |
My analysis from yesterday was incorrect. Looked at the wrong piece of code. I recompiled with pseudo names and pretty printed to get a look at the actual generated code. https://gist.github.com/thheller/7f43caf785f1846ef6d0cd05a7bcbabc#file-quill-js-L1943-L1969
is turned into
the If I read this correctly it doesn't seem to differentiate between |
Ok, there is the "instanceof". I think I can guess the chain of events: "Constructor" is not used for anything but the "instanceof" check. The logic added in the problematic change is trying to remove definitions only used for instanceof checks. It incorrectly replaces the "instanceof" expression with "false". The function is that inlined, and the rest of the constructor body removed. Thanks for the details, this should be easy enough to back off when the definition of the variable isn't a known object. |
Here's a simpler repro. var C = function C() {
if (!(this instanceof C)) {
throw new Error('not an instance');
}
}
use(new C()); |
|
fix sent for internal review |
Fixes google#2822 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187405970
There seems to be an issue with the v20180204 Closure Compiler release where some code seems to be altered that shouldn't be. The previous v20180101 (and others) work without issue. The reported warnings seem to be identical and can be ignored.
This was reported by a shadow-cljs user but I managed to trace this down to the recent Closure release and reproduced it with just the distributed
.jar
files.Originially this was discovered as part of a ClojureScript build which imported the
quill
npm package viareact-quill
, which stopped working when I released a newshadow-cljs
version usingv20180204
.Steps To Reproduce
Download necessary things
Compile with bad version
Open Browser
Fails with Error (See Browser Console)
Compile with good version
Reload browser and Error is gone.
Running
git bisect
traced down this issue to this commit:The text was updated successfully, but these errors were encountered: