wasm/web: async-body `-`, `*`, `/`, `%` use raw f64 arithmetic without ToNumber
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust, typescript, wasm
Research direction
Read crates/perry-codegen-wasm/src/emit/js_fallback.rs and compare the async-body emission for Sub, Mul, Div and Mod with the sync path's ToNumber handling. Reproduce the reported string and boolean operand cases in an async function, then check the generated behavior against the expected results. Done when those operators in async bodies produce the expected numeric results.
Written by the indexing model from the issue text.
Description
The async-body JS fallback (crates/perry-codegen-wasm/src/emit/js_fallback.rs) emits Sub/Mul/Div/Mod on the raw f64 representation of the operands, without the ToNumber conversion the sync path applies. A string or boolean operand is therefore expected to compute the wrong value inside an async function (not yet reproduced):
async function f() { console.log("5" - 2, "6" * "2", true + 0); }
f(); // node: 3 12 1
Noticed while reviewing #15092 (which fixed the bitwise, shift, ** and in operators on the same path). Related: #14595.
- Dominant language
- Rust
- Stars
- 4.9k
- Forks
- 166
- Avg merge
- 6h 5m
- Merged PRs (30d)
- 949
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
-
area:stdlib effort:S impact:med platform:linux type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:low platform:wasm type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:low platform:wasm type:chore
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:low platform:wasm type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
416rehman/Guardrails#1716 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dginev/latexml-oxide#943 ·
Maintainers usually reply within 1 day
-
bug ready
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MartinPTielemans/ilo#3731 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
oetiker/shadcn-egui#50 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
vymalo/another-agentic-system#412 ·
Maintainers usually reply within 1 day