Skip to content

Conversation

@auduchinok
Copy link
Member

Add recovery for various constructors:

type T()
type T() as = class end
type T() as this
type T() as
type T as this
type T as
type T() =
    new ()
type T() =
    new () =
type T() =
    new () as = ()
type T() =
    new () as
type T() =
    new () as this

@auduchinok auduchinok requested a review from a team as a code owner June 19, 2023 19:35
@auduchinok auduchinok force-pushed the parser-typeAs branch 2 times, most recently from 2faa149 to d497964 Compare June 20, 2023 10:49
@auduchinok
Copy link
Member Author

This is ready. 🙂

@auduchinok
Copy link
Member Author

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

@psfinaki
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@auduchinok
Copy link
Member Author

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

@edgarfgp
Copy link
Contributor

edgarfgp commented Jun 26, 2023

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

type A =
    private  { // Error recovery if { is missing
        _B: int
    } // Error recovery if } is missing
    static member Create(b) =
        { _B = b }
    member this.B = this._B

@auduchinok
Copy link
Member Author

@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
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:main Jun 26, 2023
@auduchinok auduchinok deleted the parser-typeAs branch June 26, 2023 15:07
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.

5 participants