Parsing bug w/ `do while` found by `parser/fuzz/module_roundtrip_structured`
Opened this issue · 3 comments
ezno/parser/fuzz/fuzz_targets/module_roundtrip_structured.rs
Lines 31 to 35 in 245d530
input: `do (/a/d); while (this);
`
output1: `do /a/d; while (this);
`
It looks like the parse and print removes the parentheses from the do statement, which causes Ezno to interpret the first /
as a "divide" statement.
Biome Playground of input
: https://biomejs.dev/playground/?code=ZABvACAAKAAvAGEALwBkACkAOwAgAHcAaABpAGwAZQAgACgAdABoAGkAcwApADsACgA%3D
Biome Playground of output1
: https://biomejs.dev/playground/?code=ZABvACAALwBhAC8AZAA7ACAAdwBoAGkAbABlACAAKAB0AGgAaQBzACkAOwAKAA%3D%3D
Another example I think:
input: `while (class e extends async function({ [(/a/d)] : d }) {} {}) {
}
`
output1: `while (class e extends async function ({ [/a/d]: d }) {} {}) {}
`
This parse should not error because it was just parsed above.
error: `ParseError { reason: "Expected identifier at variable reference, found Divide", position: 42..43 }`
sounds like the actual JS is a bit angry at runtime, since the async fn doesn't count as a constructor, but I think it's syntactically correct. The printed version (output1) is also close to what biome and prettier output.