You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have found a case where a property of a conditionally accessed object is incorrectly removed. This is a critical issue as it's impossible to lint for in a large code base and will fail at runtime.
const X = {Y: 1};
function fn(a) {
if (a) {
return a ? X : {};
}
}
console.log(fn(true).Y);
java -jar compiler.jar -O ADVANCED --js test.js
output:
var a;a={};console.log(a.a);
expected output:
var a;a={a:1};console.log(a.a);
Notes:
Remove either of the conditions and it works as expected
Move the X variable declaration into fn and it works as expected.
Inline the fn and it works as expected.