Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js_parser): fix Parser is no longer progressing for an invalid object member name #4423

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

denbezrukov
Copy link
Contributor

Summary

This PR addresses an issue reported in Biome Issue #342.

The problem occurs when Biome tries to parse the following code snippet:

return (pathname: string | null | undefined) > {   // <------------- look here we have missing = token
  const params: { [paramName: string]: string | string[] } = {}
}

Biome fails to parse it correctly, resulting in a parser error:

The parser is no longer progressing. Stuck at ']' R_BRACK:678..679
panicked at /biome/crates/biome_parser/src/lib.rs:535:9: The parser is no longer progressing. Stuck at ']' R_BRACK:678..679

This PR fixes the parser's handling of this syntax, preventing it from getting stuck.

Test Plan

Added a new test case to biome_js_parser to ensure this issue is resolved. Run cargo test -p biome_js_parser to verify.

@github-actions github-actions bot added A-Parser Area: parser L-JavaScript Language: JavaScript and super languages labels Oct 29, 2024
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 48421 48421 0
Passed 47221 47221 0
Failed 1200 1200 0
Panics 0 0 0
Coverage 97.52% 97.52% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6580 6580 0
Passed 2205 2205 0
Failed 4375 4375 0
Panics 0 0 0
Coverage 33.51% 33.51% 0.00%

ts/babel

Test result main count This PR count Difference
Total 680 680 0
Passed 607 607 0
Failed 73 73 0
Panics 0 0 0
Coverage 89.26% 89.26% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18508 18508 0
Passed 14168 14168 0
Failed 4340 4340 0
Panics 0 0 0
Coverage 76.55% 76.55% 0.00%

Copy link

codspeed-hq bot commented Oct 29, 2024

CodSpeed Performance Report

Merging #4423 will improve performances by 7.02%

Comparing fix/crashes (d1ae51c) with main (d4d6a93)

Summary

⚡ 1 improvements
✅ 98 untouched benchmarks

Benchmarks breakdown

Benchmark main fix/crashes Change
react.production.min_3378072959512366797.js[cached] 2 ms 1.9 ms +7.02%

@github-actions github-actions bot added the A-Changelog Area: changelog label Oct 29, 2024
@denbezrukov denbezrukov merged commit 6a8ff77 into main Oct 29, 2024
13 checks passed
@denbezrukov denbezrukov deleted the fix/crashes branch October 29, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Parser Area: parser L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants