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

Pattern inside when clause #1545

Closed
1 of 3 tasks
nojaf opened this issue Mar 26, 2021 · 0 comments · Fixed by #1547
Closed
1 of 3 tasks

Pattern inside when clause #1545

nojaf opened this issue Mar 26, 2021 · 0 comments · Fixed by #1547

Comments

@nojaf
Copy link
Contributor

nojaf commented Mar 26, 2021

Issue created from fantomas-online

Code

let GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel =
  let g = cenv.g
  match (f, tyargs, curriedArgs) with
  // Look for tailcall to turn into branch 
  | (Expr.Val (v, _, _), _, _) when
        match ListAssoc.tryFind g.valRefEq v eenv.innerVals with
        | Some (kind, _) ->
           (not v.IsConstructor &&
            (* no tailcall out of exception handler, etc. *)
            (match sequelIgnoringEndScopesAndDiscard sequel with Return | ReturnVoid -> true | _ -> false))
        | None -> false
    ->
        ()

Result

let GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel =
    let g = cenv.g

    match (f, tyargs, curriedArgs) with
    // Look for tailcall to turn into branch
    | (Expr.Val (v, _, _), _, _) when
        match ListAssoc.tryFind g.valRefEq v eenv.innerVals with
        | Some (kind, _) ->
            (not v.IsConstructor
             && (* no tailcall out of exception handler, etc. *)
             (match sequelIgnoringEndScopesAndDiscard sequel with
              | Return
              | ReturnVoid -> true
              | _ -> false))
        | None -> false -> ()

Problem description

The arrow of the clause match should be on the next line when the when expression contains a pattern match.
| None -> false -> ()

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/26/2021 09:37:20 - 2cfd9ae

    { config with
                MultilineBlockBracketsOnSameColumn = true }

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant