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

Wrong code is generated for member attribute in recursive type #1898

Closed
1 of 3 tasks
Dolfik1 opened this issue Sep 20, 2021 · 1 comment · Fixed by #1972
Closed
1 of 3 tasks

Wrong code is generated for member attribute in recursive type #1898

Dolfik1 opened this issue Sep 20, 2021 · 1 comment · Fixed by #1972

Comments

@Dolfik1
Copy link

Dolfik1 commented Sep 20, 2021

Issue created from fantomas-online

Code

type Test1() =
  member x.Test() = ()

and Test2() =

  let someEvent = Event<EventHandler<int>, int>()
  
  [<CLIEvent>]
  member x.SomeEvent = someEvent.Publish

Result

type Test1() =
    member x.Test() = ()

and Test2() =

    let someEvent = Event<EventHandler<int>, int>()

    member [<CLIEvent>] x.SomeEvent = someEvent.Publish

Problem description

Fantomas generates invalid code. But all is working fine if replace and with type (remove recursive type)

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 4.6 branch at 09/17/2021 07:14:29 - 735d58e

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor

nojaf commented Sep 20, 2021

Hi there, thank you for reporting this issue.
This one might be related to #1874, are you interested in submitting a PR?

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