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

Const() stripped from string literals [breaking] #1574

Closed
2 of 3 tasks
piaste opened this issue Apr 2, 2021 · 2 comments · Fixed by #1578
Closed
2 of 3 tasks

Const() stripped from string literals [breaking] #1574

piaste opened this issue Apr 2, 2021 · 2 comments · Fixed by #1578

Comments

@piaste
Copy link
Contributor

piaste commented Apr 2, 2021

Issue created from fantomas-online

Code

type T = SomeTypeProvider<const(" string literal " + REUSED_ LITERAL_STRING)> 

Result

type T = SomeTypeProvider<(" string literal " + REUSED_ LITERAL_STRING)>

Problem description

const() is a fairly obscure F# keyword that allows you to create an inline string literal by composing multiple string literals together (instead of declaring a separate let [<Literal>] value = ...).

It is most useful for type provider parameters, which specifically require string literals.

Fantomas deletes it, which breaks such code.

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 04/01/2021 13:51:56 - a16da08

Default Fantomas configuration

@nojaf
Copy link
Contributor

nojaf commented Apr 3, 2021

Hello piaste, thanks for reporting this issue.
I had no idea this even existed.
My fix for this might be a bit naive as it is based only on this one example.
Please report any further issues you might discover.

@piaste
Copy link
Contributor Author

piaste commented Apr 6, 2021

Thanks, I tested it on our codebase and the issue is fixed.

@piaste piaste changed the title Const() stripped from string literals [bvreak Const() stripped from string literals [breaking] Apr 6, 2021
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

Successfully merging a pull request may close this issue.

2 participants