Bug Report
- I would like to work on a fix!
Originally reported by @ehoogeveen in #12383 (comment). I managed to create a way smaller example which reproduces the bug.
I’m opening a new issue because I believe it’s not related to #12383.
Current behavior
RangeError: /home/nicolo/Documenti/dev/babel-bugs/issue-12383/d3.js: Maximum call stack size exceeded
at NodePath.get (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/family.js:181:13)
at NodePath._resolve (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/introspection.js:316:14)
at NodePath.resolve (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/introspection.js:307:15)
at /home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js:72:27
at Array.filter (<anonymous>)
at getConstantViolationsBefore (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js:71:21)
at getTypeAnnotationBindingConstantViolations (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js:36:28)
at NodePath._default (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js:22:14)
at NodePath._getTypeAnnotation (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/index.js:59:20)
at NodePath.getTypeAnnotation (/home/nicolo/Documenti/dev/babel-bugs/issue-12383/node_modules/@babel/traverse/lib/path/inference/index.js:23:19) {
code: 'BABEL_TRANSFORM_ERROR'
}
Input Code
function test() {
var b, c;
do {
c = 1;
b = c;
} while (false);
c = b;
c !== b;
}
Expected behavior
It shouldn’t crash
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.json
{
"plugins": [
"babel-plugin-transform-simplify-comparison-operators"
]
}
Environment
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [e.g. Node 8/npm 5]
- OS: [e.g. OSX 10.13.4, Windows 10]
- Monorepo: [e.g. yes/no/Lerna]
- How you are using Babel: [e.g.
cli
,register
,loader
]
Possible Solution
Additional context
A smaller example, not relying on
babel-minify
:^ This also reproduces the bug with Babel 7.12.0, so again it’s a bug that was already present but that now is more common.