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 generic constraint placement in ML-style generic definitions with multiple type parameters #1868

Closed
2 of 3 tasks
piaste opened this issue Aug 16, 2021 · 3 comments · Fixed by #2521
Closed
2 of 3 tasks
Labels
bug (soundness) good first issue Long hanging fruit: easy issue to get your feet wet!

Comments

@piaste
Copy link
Contributor

piaste commented Aug 16, 2021

Issue created from fantomas-online

Code

module Utils

/// ML-style alias of Map
type ('key, 'value) map when 'key : comparison = Map<'key, 'value>

Result

module Utils

/// ML-style alias of Map
type ('key, 'value when 'key: comparison) map = Map<'key, 'value>

Problem description

Using ML-style generic type definitions is an uncommon but supported syntax choice.

To use multiple type parameters, they're wrapped in parentheses like a tuple. Fantomas puts any generic type constraints inside those parentheses, instead of outside as correct.

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/11/2021 17:06:14 - 383b729

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 Aug 21, 2021

Thanks for the report, are you interested in submitting a PR?

@piaste
Copy link
Contributor Author

piaste commented Aug 22, 2021

Yes, I hope to get the chance next week.

@nojaf nojaf added the good first issue Long hanging fruit: easy issue to get your feet wet! label Sep 19, 2022
@nojaf
Copy link
Contributor

nojaf commented Sep 19, 2022

This problem seems fixed now.
A regression test could close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (soundness) good first issue Long hanging fruit: easy issue to get your feet wet!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants