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

Duplicate newline after shifting trivia between else if #2752

Closed
3 tasks
nojaf opened this issue Jan 30, 2023 · 0 comments · Fixed by #2782
Closed
3 tasks

Duplicate newline after shifting trivia between else if #2752

nojaf opened this issue Jan 30, 2023 · 0 comments · Fixed by #2782
Labels
bug (stylistic) good first issue Long hanging fruit: easy issue to get your feet wet!

Comments

@nojaf
Copy link
Contributor

nojaf commented Jan 30, 2023

Issue created from fantomas-online

Formatted code

// check for match
if nargTs <> haveArgTs.Length then
    false (* method argument length mismatch *)
else if


    // If a known-number-of-arguments-including-object-argument has been given then check that
    (match knownArgCount with
     | ValueNone -> false
     | ValueSome n -> n <> (if methInfo.IsStatic then 0 else 1) + nargTs)
then
    false
else

    let res = typesEqual (resT :: argTs) (haveResT :: haveArgTs)
    res

Reformatted code

// check for match
if nargTs <> haveArgTs.Length then
    false (* method argument length mismatch *)
else if

    // If a known-number-of-arguments-including-object-argument has been given then check that
    (match knownArgCount with
     | ValueNone -> false
     | ValueSome n -> n <> (if methInfo.IsStatic then 0 else 1) + nargTs)
then
    false
else

    let res = typesEqual (resT :: argTs) (haveResT :: haveArgTs)
    res

Problem description

Interesting to see where the duplicate newline came from.
Definitely related to the changes of #2663.

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 main branch at 2023-01-25T22:29:00Z - 646d19d

    { config with
                KeepMaxNumberOfBlankLines = 1 }

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (stylistic) 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.

1 participant