google / google/closure-compiler

Type checker complains of redefinition when assigning to a parameter that shadows an extern constructor

Open
#1,729 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

The following code should be fine, but causes an [error](https://closure-compiler-debugger.appspot.com/#input0%3Dpolyfill%28function%28Map%29%2520%257B%250A%2520%2520%252F**%2520%2540constructor%2520*%252F%250A%2520%2520Map%2520%253D%2520function%28%29%2520%257B%257D%253B%250A%257D%29%253B%26input1%26conformanceConfig%26externs%3D%252F**%2520%2540param%2520%257Bfunction%28*%29%253A%2520*%257D%2520func%2520*%252F%250Afunction%2520polyfill%28func%29%2520%257B%257D%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1):

``` js
polyfill(function(Map) {
/** @constructor */
Map = function() {};
});
```

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.