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

base keyword given backticks when overriding with argument #2212

Closed
1 of 3 tasks
pbiggar opened this issue Apr 27, 2022 · 4 comments · Fixed by #2240
Closed
1 of 3 tasks

base keyword given backticks when overriding with argument #2212

pbiggar opened this issue Apr 27, 2022 · 4 comments · Fixed by #2240

Comments

@pbiggar
Copy link
Contributor

pbiggar commented Apr 27, 2022

Issue created from fantomas-online

Code

type X =  
  override this.f(y) : bool =
    base.f(y)

Result

type X =
    override this.f(y) : bool = ``base``.f (y)

Problem description

base is given backticks by fantomas, which isn't right. Note that if there is no argument to the base method being called, base is not given backticks.

type X =
    override this.f() : bool = base.f()

Extra information

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

Options

Fantomas master branch at 2022-04-25T16:08:33Z - 2d32fac

    { config with
                MaxLineLength = 80 }
@pbiggar
Copy link
Contributor Author

pbiggar commented Apr 27, 2022

Also, omitting the parens around the argument also makes the formatting work correctly:

type X =
    override this.f(y) : bool = base.f y

@nojaf
Copy link
Contributor

nojaf commented Apr 29, 2022

Hello, this might be related to dotnet/fsharp#12303.
Perhaps we should roll with our own helper function on when to introduce backticks and when not.

@pbiggar
Copy link
Contributor Author

pbiggar commented May 7, 2022

Thanks @nojaf!

@nojaf
Copy link
Contributor

nojaf commented May 7, 2022

This is fix is available at https://github.com/fsprojects/fantomas/releases/tag/v5.0.0-alpha-005.
Please give that a spin to see if there any regressions on your end.
//cc @StachuDotNet

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