google / google/closure-compiler

Local types not recognized with ChromePass rewriting

Open
#3,449 0 comments 0 reactions 0 assignees View on GitHub
internal-issue-created triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

I'm creating this issue based on https://github.com/google/closure-compiler/issues/544. In the general case, local types work correctly, but there are a few cases where they don't work with the ChromePass.

[Here's a repro](https://closure-compiler-debugger.appspot.com/#input0=cr.define(%27foo%27%2C%20function()%20%7B%0A%20%20%2F**%20%40typedef%20%7Bnumber%7D%20*%2F%20var%20Num%3B%0A%20%20%0A%20%20%2F**%20%40enum%20%7Bstring%7D%20*%2F%0A%20%20const%20MyEnum%20%3D%20%7B%20HELLO%3A%20%27world%27%20%7D%3B%0A%0A%20%20%2F**%0A%20%20%20*%20%40param%20%7B!Num%7D%20a%0A%20%20%20*%20%40param%20%7B!MyEnum%7D%20b%0A%20%20%20*%20%40return%20%7B!Num%7D%0A%20%20%20*%2F%0A%20%20function%20foo(a%2C%20b)%20%7B%20return%20a%3B%20%7D%0A%20%20foo(3%2C%20MyEnum.HELLO)%3B%0A%0A%0A%20%20%2F**%0A%20%20%20*%20%40param%20%7B!foo.Num%7D%20a%0A%20%20%20*%20%40param%20%7B!MyEnum%7D%20b%0A%20%20%20*%20%40return%20%7B!foo.Num%7D%0A%20%20%20*%2F%0A%20%20function%20bar(a%2C%20b)%20%7B%20return%20a%3B%20%7D%0A%20%20bar(3%2C%20MyEnum.HELLO)%3B%0A%20%0A%20%20return%20%7B%0A%20%20%20%20Num%3A%20Num%2C%0A%20%20%20%20MyEnum%3A%20MyEnum%2C%0A%20%20%7D%3B%0A%7D)%3B&input1&conformanceConfig&externs&refasterjs-template&includeDefaultExterns=true&CHECK_TYPES=true&CHECKS_ONLY=true&CHROME_PASS=true&CLOSURE_PASS=true&PRESERVE_TYPE_ANNOTATIONS=true&PRETTY_PRINT=true) (contributed by a Google dev who I'm not sure is on GitHub.)

This maps to Google internal issue http://b/138239994.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.