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

Backticks in optional parameter gets removed #2954

Closed
2 of 4 tasks
jindraivanek opened this issue Sep 6, 2023 · 2 comments · Fixed by #2956
Closed
2 of 4 tasks

Backticks in optional parameter gets removed #2954

jindraivanek opened this issue Sep 6, 2023 · 2 comments · Fixed by #2956
Assignees

Comments

@jindraivanek
Copy link
Contributor

Issue created from fantomas-online

Code

type C() =
    static member foo(?``type``) = ``type``
        

Result

type C() =
    static member foo(?type) = ``type``

Problem description

Backticks removed in ?type - incorrect code.

Probably related to #2731.

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.
  • I would like a release if this problem is solved.

Options

Fantomas main branch at 2023-08-31T06:37:49Z - 369faf8

Default Fantomas configuration

@nojaf
Copy link
Contributor

nojaf commented Sep 6, 2023

Hi there,

We don't process SynPat.OptionalVal correctly in

| SynPat.OptionalVal(ident, _) -> stn $"?{ident.idText}" patternRange |> Pattern.OptionalVal

It should be more something like:

let identNode = mkIdent ident
SingleTextNode($"?{identNode.Text}", patternRange) |> Pattern.OptionalVal

Are you interested in submitting a PR?

@jindraivanek
Copy link
Contributor Author

Are you interested in submitting a PR?

Yes, it looks simple enough :)

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