Skip to content

Bug: misalignment of parenthesised if ... then ... else expressions #1415

@craigfe

Description

@craigfe

The following excerpt is OCamlFormat-ted:

let () =
  ( if a then
    b_____________________________________________________________________
  else c )
  |> f

let () =
  ( if a______________________________________________________________________
  then b )
  >>= fun () -> c

let () =
  [
    ( if a_______________________________________________ then
      b_____________________
    else c_________________________ );
  ]

let () =
  f
    ( if a___________________________________________________________________
    then b_________________________________________________________________
    else c_________________________________________________________________ )

[@@@ocamlformat "indicate-multiline-delimiters=no"]

let () =
  f
    (if a___________________________________________________________________
   then b_________________________________________________________________
    else c_________________________________________________________________)

In each case, the if ... then ... else keywords are not left-aligned, whereas in contexts with no surrounding parens they would be left-aligned.

I suspect this is a bug, but feel free to recategorise as a feature request if you think it's more appropriate 🙂

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions