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

Attribute on type function incorrectly placed for 'and' types. #1874

Closed
1 of 3 tasks
OkkeHendriks opened this issue Sep 2, 2021 · 3 comments · Fixed by #1972
Closed
1 of 3 tasks

Attribute on type function incorrectly placed for 'and' types. #1874

OkkeHendriks opened this issue Sep 2, 2021 · 3 comments · Fixed by #1972

Comments

@OkkeHendriks
Copy link
Contributor

Issue created from fantomas-online

Code

module test 
open System.Diagnostics 

type Correct = 
    | A of unit

    [<DebuggerStepThrough>]
    override this.ToString () = ""

    [<DebuggerStepThrough>]
    member this.f = ()

    [<DebuggerStepThrough>]
    static member this.f = ()

and Wrong =  
    | B of unit

    [<DebuggerStepThrough>]
    override this.ToString () = ""

    [<DebuggerStepThrough>]
    member this.f = ()

    [<DebuggerStepThrough>]
    static member this.f = ()

Result

module test

open System.Diagnostics

type Correct =
    | A of unit

    [<DebuggerStepThrough>]
    override this.ToString() = ""

    [<DebuggerStepThrough>]
    member this.f = ()

    [<DebuggerStepThrough>]
    static member this.f = ()

and Wrong =
    | B of unit

    override [<DebuggerStepThrough>] this.ToString() = ""

    member [<DebuggerStepThrough>] this.f = ()

    static member [<DebuggerStepThrough>] this.f = ()

Problem description

Attribute on type function incorrectly placed after formatting for 'and' types only.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 08/19/2021 16:27:53 - a80f888

Default Fantomas configuration

@OkkeHendriks OkkeHendriks changed the title Attribute on type function incorrectly placed at 'and' types. Attribute on type function incorrectly placed for 'and' types. Sep 2, 2021
@nojaf
Copy link
Contributor

nojaf commented Sep 6, 2021

Hey there, thanks for the report.
I would guess that this is an ASTContext bug.
Are you interested in submitting a PR?

@OkkeHendriks
Copy link
Contributor Author

I would be interested but I am very busy with work at the moment so not sure at all when I would have the time to look into this. Also because I have zero experience with the Fantomas code base. I worked around it by not using and for the moment.

If/when I can have a look i'll let you know, but I wouldn't hold my breath😒, sorry!

@nojaf
Copy link
Contributor

nojaf commented Sep 6, 2021

No worries, I totally understand. If you ever find the time and courage, some good starting points are the YouTube videos and our contribution guidelines.
Or feel free to poke me here if you have additional questions.

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

Successfully merging a pull request may close this issue.

2 participants