Skip to content

[Bug]: Duplicate declaration in transformed for...of #14379

@clhiker

Description

@clhiker

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

function toLowerCase(){}
low = {toLowerCase}
const v1 = fullStr => {
    const v2 = new Map();
    const v3 = [1,2,3];
    for (let v4 of v3) {
        let {
            v20: v0,
            v4 : v4
        } = {
            [6]: 5,
            get: -12
        };
    }
    return v2;
};
v1(low)

Here is the REPL

Configuration file name

babel.config.json

Configuration

{
  "sourceType": "unambiguous",
  "presets": ["@babel/preset-env"],
  "plugins": [
    "@babel/plugin-transform-runtime"
  ]
}

Current and expected behavior

The input code can be run by node, but when it is converted by babel, there is an error report

Duplicate declaration "v4"

Environment

  • babel
    • ├── @babel/cli@7.17.0=6
    • ├── @babel/generator@7.17.3
    • ├── @babel/plugin-transform-runtime@7.17.0
    • ├── @babel/preset-env@7.16.11
  • Node: [v17.3.0]
  • npm version [8.5.2]
  • os [ubuntu 20.04]

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions