Skip to content

"missing require" warning when calling methods of values of object literals #3012

Open
@phistuck

Description

@phistuck

When running -
java -jar closure-compiler-v20180610.jar --js trial.js --language_in ECMASCRIPT_NEXT -O ADVANCED_OPTIMIZATIONS --jscomp_warning '*' --warning_level VERBOSE --js_output_file trial.min.js

Where trial.js is -

const foo = {baz: "baz"};

/** @return {boolean} */
function call()
{
 return foo.baz.includes("a");
}

I wrongly get -

trial.js:6: WARNING - missing require: 'foo.baz'
 return foo.baz.includes("a");
        ^^^^^^^^^^^^^^^^^^^^^

0 error(s), 1 warning(s), 91.9% typed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions