Skip to content

Conversation

@auduchinok
Copy link
Member

@auduchinok auduchinok commented Jun 15, 2023

Various unfinished type cases:

type T with

()
type
type T =
type T1 = int
and
type T1 = int
and T2 = 
type T1 = int
and
and T3 = int

Unfinished types ending with with and = are recovered due to the new indentation rules.

@auduchinok auduchinok requested a review from a team as a code owner June 15, 2023 15:12
@auduchinok auduchinok changed the title Parser: recover on unfinished 'type' declarations Parser: recover on unfinished type declarations Jun 15, 2023
@auduchinok
Copy link
Member Author

auduchinok commented Jun 16, 2023

Phew, this one is ready too! 🎉

It was the most difficult to go through the CI so far due to disallowing this:

type T with
member this.NoIndentation = 1 // breaks parsing of things below

Like in #15392, it now produces a new indentation warning with the old rules, and an error with the new ones.

Deindenting union cases is still allowed as it allows subsequent things to be parsed correctly:

type U =
| A // there's an existing special case allowing this for union cases

()

@edgarfgp
Copy link
Contributor

Will this cover the cases unfinished code with types using the using verbose syntax ?.

@auduchinok
Copy link
Member Author

@edgarfgp Could you elaborate, please?

@edgarfgp
Copy link
Contributor

Sure. I was referring to the cases with

type A = class //end  --missing end

type I = interface // --missing end

@auduchinok
Copy link
Member Author

I see, thanks.
No, I haven't touched those parts of the grammar yet.

@vzarytovskii vzarytovskii merged commit 7a95c98 into dotnet:main Jun 19, 2023
@auduchinok auduchinok deleted the parser-typeWith branch June 19, 2023 19:28
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.

4 participants