Skip to content

Bug: Unstable comment with if-then-else = keyword-first #2749

@Julow

Description

@Julow

The comments in the following code are unstable with this configuration:

profile = default
if-then-else = keyword-first
let%shared default_make_transform ~vertical ?(delta = 0) pos =
  let p = -pos * 100 in
  if vertical
  (* then Printf.sprintf "translate3d(0, %.3f%%, 0)" d *)
  (* else Printf.sprintf "translate3d(%.3f%%, 0, 0)" d *)
  then Printf.sprintf "translateY(%d%%) translateY(%dpx)" p delta
  else Printf.sprintf "translateX(%d%%) translateX(%dpx)" p delta

Debug output:

@@ -1,8 +1,8 @@
 let%shared default_make_transform ~vertical ?(delta = 0) pos =
   let p = -pos * 100 in
   if
-    vertical(* then Printf.sprintf "translate3d(0, %.3f%%, 0)" d *)
-            (* else Printf.sprintf "translate3d(%.3f%%, 0, 0)" d *)
-    
+    vertical
+    (* then Printf.sprintf "translate3d(0, %.3f%%, 0)" d *)
+    (* else Printf.sprintf "translate3d(%.3f%%, 0, 0)" d *)
   then Printf.sprintf "translateY(%d%%) translateY(%dpx)" p delta
   else Printf.sprintf "translateX(%d%%) translateX(%dpx)" p delta
ocamlformat: Cannot process "local/test.ml".
  Please report this bug at https://github.com/ocaml-ppx/ocamlformat/issues.
  BUG: formatting did not stabilize after 10 iterations.
# Failed

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