Skip to content

comments moving in ways that change their meaning #917

@ceastlund

Description

@ceastlund

I am using ocamlformat built from 2c8d454.

This program ...

let _ =
  try_with (fun () ->
    match get () with
    | None -> do_something ()
    | Some _ -> () (* do nothing *))
;;

... gets rewritten to this.

let _ =
  try_with (fun () ->
    (* do nothing *)
    match get () with
    | None -> do_something ()
    | Some _ -> ())
;;

This program ...

let _ =
  try_with (fun () ->
    a;
    b (* after a *))
;;

... gets rewritten to this.

let _ =
  try_with (fun () ->
    (* after a *)
    a;
    b)
;;

In both cases the comment becomes nonsensical.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions