NumberAtReadFlow: catch starts from the try's entry state, so a non-Number write before a throw is not seen in the catch (suspected)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, rust, typescript
- Domain
- compilers
Research direction
Start in the number_by_construction pass and find how NumberAtReadFlow seeds the entry state for a catch block. First reproduce the example from the issue with node and with perry, since the report says the bug is unconfirmed. Done means the repro shows the mismatch and the catch entry state includes writes made inside the try before a throw.
Written by the indexing model from the issue text.
Description
Found by review in the lblk lane (#12665); not yet reproduced. In number_by_construction's NumberAtReadFlow, a catch block starts from the state at try entry. A write that can make a local non-Number inside the try before a throw is therefore not joined into the catch, e.g.
function f(k) { let v = 1; try { v = k ? undefined : 2; if (k) throw 0; } catch (e) { return v + 1; } return v; }
console.log(f(1)); // node: NaN
Expected fix: the catch entry state is the join of the states at every point in the try that can throw (conservatively: the join of entry and every state reached in the try). Needs a repro run first.
- Dominant language
- Rust
- Stars
- 4.9k
- Forks
- 166
- Avg merge
- 2h 54m
- Merged PRs (30d)
- 922
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PerryTS/perry
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
home-assistant/installer#308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ProvableHQ/leo#29657 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
swc-project/swc-next#1053 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nautechsystems/nautilus_trader#5387 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
NomicFoundation/edr#1872 ·
Maintainers usually reply within 2 days