馃拝 Consistent crash on malformed ternary聽#1695
Copy link
Copy link
Closed
Labels
A-ParserArea: parserArea: parserL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bugS-Help-wantedStatus: you're familiar with the code base and want to help the projectStatus: you're familiar with the code base and want to help the project
Description
Environment information
CLI:
Version: 1.5.3
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_DIR: unset
NO_COLOR: unset
TERM: "xterm-256color"
JS_RUNTIME_VERSION: "v21.5.0"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "bun/1.0.25"
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: false
VCS disabled: true
Workspace:
Open Documents: 0Rule name
lint/correctness/noUnusedVariables
Playground link
Expected result
I'm getting this crash message:
Source Location: /home/runner/work/biome/biome/crates/biome_js_semantic/src/semantic_model/model.rs:334:46
Thread Name: main
Message: no entry found for key
Just as the placeholder for this field says, "It should not throw an error." 馃槤
Code of Conduct
- I agree to follow Biome's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ParserArea: parserArea: parserL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bugS-Help-wantedStatus: you're familiar with the code base and want to help the projectStatus: you're familiar with the code base and want to help the project
Activity
ematipico commentedon Jan 29, 2024
The code that you pasted is not valid. Look at the playground, and even Prettier throws an error. And TS too
I'm not sure why we don't throw any diagnostic though, that's weird.
fmajestic commentedon Jan 29, 2024
Yeah, that's why I specifically said malformed ternary :D.
const [xyy:?:""\n} = bar;is also invalid code but doesn't cause a hard crash.I managed to narrow down the crash to that specific lint rule, but it happened while I was editing a file and typed in an "empty" ternary like that.
ematipico commentedon Jan 29, 2024
Yeah, but the issue is not the linter. It's a parser issue :)
togami2864 commentedon Jan 30, 2024
I'll take a look:)
togami2864 commentedon Feb 4, 2024
The parser seems to be working fine, but the issue only reproduces in the production environment馃
Screen.Recording.2024-02-04.at.16.43.37.mov
ah-yu commentedon Feb 4, 2024
Hey @togami2864 , I took a look at this issue before and have some observations that I hope will be helpful:
NoUnusedVariablerule is enabled.I guess you can explore the issue more from here
biome/crates/biome_js_semantic/src/events.rs
Lines 484 to 487 in ee9b3ac
togami2864 commentedon Feb 4, 2024
@ah-yu Awesome! Thank you!
Conaclos commentedon Apr 26, 2024
@togami2864 Are you still working on it? If not, I could take a look :)
togami2864 commentedon Apr 27, 2024
How quickly did you fix it 馃帀 Thank you!