Skip to content

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