Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'with' incorrectly removed #469

Closed
pviotti opened this issue Aug 25, 2019 · 4 comments
Closed

'with' incorrectly removed #469

pviotti opened this issue Aug 25, 2019 · 4 comments

Comments

@pviotti
Copy link

pviotti commented Aug 25, 2019

Issue created from fantomas-ui

The keyword 'with' gets incorrectly removed.
Similarly to what pointed out in #388, which for some reason has been closed: has this been fixed? If so, could you advice on which version contains the fix? Thanks in advance.

Code

type MyType = En | It | Fr with
    override this.ToString() = toString this
    static member fromString s = fromString<MyType> s

Error

type MyType = | En | It | Fr
    override this.ToString() = toString this
    static member fromString s = fromString<MyType> s

Options

Fantomas 2.9.2

Name Value
IndentSpaceNum 4
PageWidth 120
PreserveEndOfLine true
SemicolonAtEndOfLine false
SpaceBeforeArgument true
SpaceBeforeColon false
SpaceAfterComma true
SpaceAfterSemicolon true
IndentOnTryWith false
ReorderOpenDeclaration false
SpaceAroundDelimiter true
KeepNewlineAfter false
StrictMode false
@nojaf
Copy link
Contributor

nojaf commented Aug 26, 2019

I think fantomas will never print out the with keyword as it can be left out.
We could tackle this in the trivia branch to preserve the with keyword.

@jindraivanek
Copy link
Contributor

Yes it is fixed in 3.0 (trivia) version.

I think removing with when it is not needed is OK.

@pviotti
Copy link
Author

pviotti commented Aug 26, 2019

Nothing against removing something that is useless, but, to be clear, the with in the example above should stay, otherwise it does not compile, saying error FS0010: Unexpected keyword 'override' in definition. Expected incomplete structured construct at or before this point or other token., using donet version: 2.2.108 and fsharpc version 10.2.3 for F# 4.5.

@jindraivanek
Copy link
Contributor

otherwise it does not compile

That's true for current version (2.9.2).

In newest version (3.0) it is formatted as

type MyType =
    | En
    | It
    | Fr
    override this.ToString() = toString this
    static member fromString s = fromString<MyType> s

which is correct. So, this issue is already fixed, just not released in stable.

@nojaf nojaf closed this as completed Aug 30, 2019
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

No branches or pull requests

3 participants