Skip to content

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

Closed

Description

@smoothdeveloper
// 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

Activity

  1. kerams commented on Apr 22, 2021

    @kerams
    Contributor

    Could #10872 help here?

  2. smoothdeveloper commented on Apr 22, 2021

    @smoothdeveloper
    ContributorAuthor

    @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).

  3. smoothdeveloper commented on Apr 22, 2021

    @smoothdeveloper
    ContributorAuthor

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

  4. auduchinok commented on Apr 23, 2021

    @auduchinok
    Member

    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.

  5. added
    Area-Diagnostics
    on Apr 20, 2022
  6. added this to the Backlog milestone on Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-DiagnosticsFeature Request

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions