facebookarchive / prepack

A JavaScript bundle optimizer.
http://prepack.io
Other
14.22k stars 424 forks source link

Expand x==null using a disjunction #2572

Closed sb98052 closed 6 years ago

sb98052 commented 6 years ago

Fixes #2563, #2564

NTillmann commented 6 years ago

Will #2564 require a separate fix?

sb98052 commented 6 years ago

It also fixes #2564, which was caused by the same problem. The path condition x == null was being expanded using a conjunction instead of a disjunction, as x === null && x === undefined But x === null => x !== undefined, so the second condition got discarded, effectively creating the assumption x == null => x===null. I've added the other repro as a test as well.