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

Malformed expression leads to butchered error diagnostic #173

Open
fmease opened this issue Mar 18, 2023 · 1 comment
Open

Malformed expression leads to butchered error diagnostic #173

fmease opened this issue Mar 18, 2023 · 1 comment
Labels
A-diagnostics Area: Diagnostics T-bug Type: Something isn't working as intended

Comments

@fmease
Copy link
Owner

fmease commented Mar 18, 2023

Source:

x=lengthy-space-filler (case 0 of
    \n => n
<-)

Stderr:

error[E010]: found line break but expected ‘)’
  ┌─ /home/fmease/programming/lushui/bad-diag-msg.lushui:2:13
  │
2 │     \n => n
<-)
  │           ⟫⟪ unexpected token

error: aborting due to previous error
@fmease fmease added T-bug Type: Something isn't working as intended A-diagnostics Area: Diagnostics labels Mar 18, 2023
@fmease
Copy link
Owner Author

fmease commented Mar 18, 2023

It's weird: The span resolution code of SourceMap should've either returned a single structured line that doesn't contain any line breaks or it should've returned two structured lines. Here it seems like it returned a single structured line that does contain a (trailing) line break which the diagnostic formatting code obviously can't and shouldn't need to handle correctly.

It's quite possible that the parser created a diagnostic with a span that includes a trailing line break (which is highly discouraged) but the span resolver should be pretty robust and should've been able to handle that (I've extensively tested that) if my theory checks out that is.

Needs investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Diagnostics T-bug Type: Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

1 participant