Skip to content

Conversation

@edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented May 1, 2022

Attempt to fix #8299

Copy link
Member

@vzarytovskii vzarytovskii May 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try not to add any new tests to the fsharpqa if not necessary, I've mentioned about the ComponentTests in the #8299 (comment), sorry for the delay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries :) . Thanks for taking the time . I will update this PR according with your suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vzarytovskii I realised that the #8299 talks about to show a syntax error for this rather that a compilation error.

I’m a little confused the test that I added in this PR they succeeded I was expecting them to fail As if you send interactive it show an error 😢.

Copy link
Member

@vzarytovskii vzarytovskii May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, when you call compile it will use FCS (i.e. compiler), and not fsi/interactive session.
Did you intend to test compiler or fsi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, when you call compile it will use FCS (i.e. compiler), and not fsi/interactive session.
Did you intend to test compiler or fsi?

I think the expectation would to have one for compiler(that show a syntax error) and one for fsi/interactive session(that shows an error) . So they are both consistent .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, so for compiler, you can simply leave this this test, and then fix the compiler itself, so the test passes (i.e. the compiler expected to fail).
For the FSI, you can use the runFsi function, here's the example of such test:

module ``External FSI tests`` =
[<Fact>]
let ``Eval object value``() =
Fsx "1+1"
|> runFsi
|> shouldSucceed
[<Fact>]
let ``Invalid expression should fail``() =
Fsx "1+a"
|> runFsi
|> shouldFail

Feel free to ping me on discord/slack if you have any questions.

@edgarfgp
Copy link
Contributor Author

@vzarytovskii While working on this PR and asking in discord I wonder if there is Is anything preventing us to raise this during parsing and not in CheckDeclarations ?

@auduchinok
Copy link
Member

@edgarfgp The parts that parse the constructor and the type body are implemented in different grammar rules and doing it in some parent rule would mean checking declarations produced by inner rules. The parser doesn't seem to be the right place to do this, as it's the job of the checker (that does a lot of similar checks already). Since this error is already reported for other kinds of functional F# types, the best place to implement reporting it for delegates would be somewhere near the existing cases.

@edgarfgp edgarfgp closed this May 25, 2022
@edgarfgp edgarfgp reopened this May 25, 2022
@edgarfgp edgarfgp closed this May 26, 2022
@edgarfgp edgarfgp reopened this May 26, 2022
@edgarfgp
Copy link
Contributor Author

I have made the changes and wrote unit test and my test all passing locally but the one the CI gates is failing due to neg06.bsl differed: a bug or baseline may need updating

@vzarytovskii
Copy link
Member

vzarytovskii commented May 26, 2022

I have made the changes and wrote unit test and my test all passing locally but the one the CI gates is failing due to neg06.bsl differed: a bug or baseline may need updating

Not yet sure why it's failing, gonna look at it later today or tomorrow morning.

Edit: oh, it seems the baseline in question needs updating, it doesn't expect new error to happen there, but it is.

@edgarfgp
Copy link
Contributor Author

@vzarytovskii CI got even more angry with my attempt of updating the baseline tests 😅. I think I’m going to take couple days to try to understand this and then come back . I think I’m close to have this green

@vzarytovskii
Copy link
Member

Oh, yeah, there was some infra issues.

@vzarytovskii
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments, @edgarfgp please take a look 🙂

Co-authored-by: Vlad Zarytovskii <[email protected]>
@edgarfgp
Copy link
Contributor Author

@vzarytovskii Something has changed on main in the code formatting and the CI fails now . Should I run fantomas on those files and commit the changes ?

@vzarytovskii
Copy link
Member

@vzarytovskii Something has changed on main in the code formatting and the CI fails now . Should I run fantomas on those files and commit the changes ?

We'll fix it in main.

@edgarfgp edgarfgp closed this Jun 1, 2022
@edgarfgp edgarfgp reopened this Jun 1, 2022
@nojaf
Copy link
Contributor

nojaf commented Jun 1, 2022

@edgarfgp congratulations on this PR!
A fine addition!

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Jun 1, 2022

@edgarfgp congratulations on this PR! A fine addition!

Thanks :) . I got inspired by your work on Fantomas

@vzarytovskii
Copy link
Member

Thanks a lot for this @edgarfgp!

@KevinRansom @dsyme this LGTM, shall we get it in?

@vzarytovskii vzarytovskii merged commit 1950309 into dotnet:main Jun 2, 2022
@dsyme
Copy link
Contributor

dsyme commented Jun 2, 2022

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No syntax error for primary constructor in delegate definition

5 participants