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

Language Parser: poor error recovery on faulty DU declaration / improve error reporting #11468

Closed
Tracked by #1103
smoothdeveloper opened this issue Apr 22, 2021 · 4 comments · Fixed by #15468
Closed
Tracked by #1103
Labels
Area-Diagnostics mistakes and possible improvements to diagnostics Feature Request
Milestone

Comments

@smoothdeveloper
Copy link
Contributor

// lots of code

type MyBrokenDU =
| A B // error FS0010: Unexpected identifier in member definition

// lots of code

I miss to put "of" between A and B, the whole file is failing to provide tooling support.

I'd expect if another declaration (a type, a binding) is encountered, it could determine the broken DU is closed.

I'd expect the error message to guide me in either:

  • you are missing of before case member definition
  • you are missing | before next case definition

related: #1103

@kerams
Copy link
Contributor

kerams commented Apr 22, 2021

Could #10872 help here?

@smoothdeveloper
Copy link
Contributor Author

@kerams, I'd say @auduchinok could help for sure 🙂

also

changes were done by @dsyme during our parser recovery work today

what would help is surfacing postmortem notes of those occurrences of collaboration from main maintainers and a detailed TOC of compiler workshop videos: (https://www.youtube.com/watch?v=3Zr0HNVcooU), both those could be .md files under fsharp.org repository.

All would help for this type of issues to get taken up by the community.

We can split the issue in two: parser recovery (hard to fix for a person not familiar with parser infrastructure) and error message (easy to tackle by community at large).

@smoothdeveloper
Copy link
Contributor Author

the thriller starts there: https://youtu.be/3Zr0HNVcooU?t=4977

@auduchinok
Copy link
Member

auduchinok commented Apr 23, 2021

Could #10872 help here?

In general it'd need a separate recovery for each place in the grammar (which sometimes would only work for some common kind of similar mistakes), so recovery in match expressions clauses won't help much with union case declarations. Though, a similar technique could be applied here, so some errors would be recovered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Diagnostics mistakes and possible improvements to diagnostics Feature Request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants