Skip to content

Parser: recover on unfinished constructors - #15440

Merged
vzarytovskii merged 5 commits into
dotnet:mainfrom
auduchinok:parser-typeAs
Jun 26, 2023
Merged

Parser: recover on unfinished constructors#15440
vzarytovskii merged 5 commits into
dotnet:mainfrom
auduchinok:parser-typeAs

Conversation

@auduchinok

Copy link
Copy Markdown
Member

Add recovery for various constructors:

typeT()
typeT()as=classend
typeT()as this
typeT()as
typeTasthis
typeTas
typeT()=new()
typeT()=new()=
typeT()=new()as=()
typeT()=new()as
typeT()=new()as this

@auduchinok
auduchinok requested a review from a team as a code ownerJune 19, 2023 19:35
@auduchinok
auduchinokforce-pushed the parser-typeAs branch 2 times, most recently from 2faa149 to d497964CompareJune 20, 2023 10:49
@auduchinok

Copy link
Copy Markdown
MemberAuthor

This is ready. 🙂

Comment threadtests/fsharp/typecheck/sigs/neg69.vsbsl Outdated
@auduchinok

Copy link
Copy Markdown
MemberAuthor

Rebased on top of the main, so the parser tests include the type checker run.

@psfinaki

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@auduchinok

Copy link
Copy Markdown
MemberAuthor

Alright, I've cherry picked the lost baseline update, and now it's green again 🙂

@edgarfgp

edgarfgp commented Jun 26, 2023

Copy link
Copy Markdown
Contributor

@auduchinok Would it make sense also to cover the case where unfinished code with a private constructor?

typeA=private{// Error recovery if { is missing
_B:int}// Error recovery if } is missingstatic memberCreate(b)={_B = b }memberthis.B= this._B

@auduchinok

Copy link
Copy Markdown
MemberAuthor

@edgarfgp There're no constructors in your code snippet.

Speaking about a missing { in a record representation, I don't think it's the order in which people normally type these things, and I wouldn't call it unfinished code in the same sense as in this PR, where the aim is to mostly help parser during typing. My guess is people usually type the braces before the typing in the fields, not the other way around.

@edgarfgp

Copy link
Copy Markdown
Contributor

@edgarfgp There're no constructors in your code snippet.

Speaking about a missing { in a record representation, I don't think it's the order in which people normally type these things, and I wouldn't call it unfinished code in the same sense as in this PR, where the aim is to mostly help parser during typing. My guess is people usually type the braces before the typing in the fields, not the other way around.

Thanks for the explanation :)

@vzarytovskii
vzarytovskii merged commit ae5e5fd into dotnet:mainJun 26, 2023
@auduchinok
auduchinok deleted the parser-typeAs branch June 26, 2023 15:07
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.

5 participants

@auduchinok@psfinaki@edgarfgp@T-Gro@vzarytovskii