Skip to content

Constant violation code path internal error #11610

@guybedford

Description

@guybedford

Bug Report

  • I would like to work on a fix!

Current behavior
A clear and concise description of the behavior.

Input Code

async function v(source, map,unmap=v=>v) {
  for await (source of source) {
  }
}

Running with preset-env with esmodules.

See REPL replication of error - https://babeljs.io/repl/#?browsers=ie%2011&build=&builtIns=false&spec=false&loose=false&code_lz=IYZwngdgxgBAZgV2gFwJYHsIwG4AoToIBOUApgDQwC2wADuUjbQLzbMB82AlDAN4BQMeOiIxgAd2CpkMfIRKkY6ODALEyPAUIC-_XUA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Cstage-3%2Cenv&prettier=false&targets=&version=7.9.6&externalPlugins=

Expected behavior
There shouldn't be an internal error during traversal of the constant violation. I'm not convinced there is even a constant violation here. Interestingly both the arrow function and repeated binding in the for loop are required to reproduce the error despite having different names.

  • Babel version(s): 7.9.6

Possible Solution
It seems like this is a scoping bug and that neither should be constantViolations during the scoping phase, so that would be the root cause here to me. But that such a constantViolation can cause an internal error may be a bug in the traversal or the population of the constantViolation code path as well I suppose.

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