Skip to content

Failing to optimize getprop #3503

@NotWearingPants

Description

@NotWearingPants

Closure Compiler with advanced optimizations fails to optimize the expression {a:0}.a to 0 in some cases.

When running:

echo console.log({a:0}.a) | java -jar closure-compiler-v20191027.jar -O ADVANCED

I get console.log({a:0}.a);

but when running:

echo console.log({a:0}.a===0) | java -jar closure-compiler-v20191027.jar -O ADVANCED

I get console.log(!0);.

It seems that the compiler knows that {a:0}.a can be reduced to 0, but doesn't always do it for no apparent reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    internal-issue-createdAn internal Google issue has been created to track this GitHub issuetriage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions