Skip to content

Parser: recover on unfinished type declarations - #15410

Merged
vzarytovskii merged 11 commits into
dotnet:mainfrom
auduchinok:parser-typeWith
Jun 19, 2023
Merged

Parser: recover on unfinished type declarations#15410
vzarytovskii merged 11 commits into
dotnet:mainfrom
auduchinok:parser-typeWith

Conversation

@auduchinok

@auduchinokauduchinok commented Jun 15, 2023

Copy link
Copy Markdown
Member

Various unfinished type cases:

typeTwith()
type
typeT=
typeT1= int
and
typeT1= int
andT2=
typeT1= int
andandT3= 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 ownerJune 15, 2023 15:12
@auduchinokauduchinok changed the title Parser: recover on unfinished 'type' declarationsParser: recover on unfinished type declarationsJun 15, 2023
@auduchinok

auduchinok commented Jun 16, 2023

Copy link
Copy Markdown
MemberAuthor

Phew, this one is ready too! 🎉

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

typeTwithmemberthis.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:

typeU=| A // there's an existing special case allowing this for union cases()

@edgarfgp

Copy link
Copy Markdown
Contributor

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

@auduchinok

Copy link
Copy Markdown
MemberAuthor

@edgarfgp Could you elaborate, please?

@edgarfgp

Copy link
Copy Markdown
Contributor

Sure. I was referring to the cases with

typeA=class//end --missing endtypeI=interface// --missing end

@auduchinok

Copy link
Copy Markdown
MemberAuthor

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

@vzarytovskii
vzarytovskii merged commit 7a95c98 into dotnet:mainJun 19, 2023
@auduchinok
auduchinok deleted the parser-typeWith branch June 19, 2023 19:28
Sign up for freeto 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

@auduchinok@edgarfgp@vzarytovskii@T-Gro