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

Removal of bar in one-case DU #1563

Closed
3 tasks
Smaug123 opened this issue Apr 1, 2021 · 5 comments · Fixed by #1632
Closed
3 tasks

Removal of bar in one-case DU #1563

Smaug123 opened this issue Apr 1, 2021 · 5 comments · Fixed by #1632

Comments

@Smaug123
Copy link
Contributor

Smaug123 commented Apr 1, 2021

Issue created from fantomas-online

Code

namespace Baz

type Foo =
    /// Hi!
    | Bar of int

Result

namespace Baz

type Foo =
    /// Hi!
    Bar of int

Problem description

The code Fantomas produces here is fine, and it compiles. However, it triggers what I assume is a compiler bug: the output documentation .xml file does not contain an entry for the DU case Bar. This breaks our internal tests asserting that our API surfaces are documented.

Would it be out of the question to give us the ability to always have the | Bar of int formatting?

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 03/31/2021 17:11:59 - 44926de

    { config with
                KeepIfThenInSameLine = true }

Signature file

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 Apr 1, 2021

I've actually already identified another case where the pipe is always necessary (See #1483).
For these kinds of scenario's, I'm in favour of always having the pipe.
I'll clarify this with the MS style guide, if they agree then I'll update Fantomas.
Otherwise, we can add this to the GR style guide and put it behind a feature flag.

@nojaf nojaf changed the title [discussion] Removal of bar in one-case DU Removal of bar in one-case DU Apr 1, 2021
@Smaug123
Copy link
Contributor Author

Smaug123 commented Apr 1, 2021

(Personally I always use the pipe whether or not it's required.)

@smoothdeveloper
Copy link
Contributor

@Smaug123

However, it triggers what I assume is a compiler bug: the output documentation .xml file does not contain an entry for the DU case Bar.

Is this reported upstream? Disregarding formatting tooling, the issue is worth bringing to attention on the compiler repository.

@Smaug123
Copy link
Contributor Author

auduchinok beat me to it and raised dotnet/fsharp#11488.

@auduchinok
Copy link
Contributor

@Smaug123 I've been playing with xml doc edge cases while working on our tree, yeah. 🙂 I actually thought I've seen this issue being reported somewhere but couldn't find where it was!

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.

4 participants