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

Parser: recover on unfinished interface member #15943

Merged
merged 6 commits into from
Sep 18, 2023

Conversation

auduchinok
Copy link
Member

@auduchinok auduchinok commented Sep 7, 2023

Adds recovery for unfinished interface member declarations:

type T =
    interface
type T =
    interface

    member _.P = 1

This requires tightening LexFilter rules for interface type representations a bit, so indent is required here:

type T =
    interface
        abstract P: int
    end

and this is no longer allowed:

type T =
    interface
    abstract P: int
    end

One special case that is still allowed is when interface is placed immediately after = and members are indented relative to the type:

type T = interface
    abstract P: int
end

because this style was a bit more used in the early days of F# and there're still some places that use it. We can, in theory, start producing a warning here and disallow it in future.

@auduchinok auduchinok requested a review from a team as a code owner September 7, 2023 10:03
@auduchinok
Copy link
Member Author

It would be nice to also allow recovery on missing end:

type T =
    interface
        abstract P: int

but it's not trivial and can be done separately from updating these LexFilter rules. I've added a pair of tests for this just in case.

@auduchinok
Copy link
Member Author

This is ready.

@vzarytovskii vzarytovskii enabled auto-merge (squash) September 18, 2023 10:39
@vzarytovskii vzarytovskii merged commit 4a9701c into dotnet:main Sep 18, 2023
24 checks passed
@auduchinok auduchinok deleted the parser-interface branch September 18, 2023 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants