Constant folding failure
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
```js
const a = 256 * 2;
```
minify to
```js
const a=512;
```
(https://esbuild.github.io/try/#dAAwLjI1LjgALS1taW5pZnkAY29uc3QgYSA9IDI1NiAqIDI7)
But
```js
0;
const a = 256 * 2;
```
minify to
```js
const a=256*2;
```
(https://esbuild.github.io/try/#dAAwLjI1LjgALS1taW5pZnkAMDsKY29uc3QgYSA9IDI1NiAqIDI7), where constant folding fails.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the two esbuild Try links and compare the minified output for the snippets with and without the leading `0;`. Trace constant-folding and statement-removal behavior in the minifier, then add or run a regression case showing that `256 * 2` becomes `512` in both contexts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, javascript
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100