ocaml-ppx / ocamlformat

Auto-formatter for OCaml code
MIT License
633 stars 179 forks source link

BUG: generating invalid ocaml syntax. #2536

Closed nojb closed 7 months ago

nojb commented 7 months ago

ocamlformat.0.26.1 chokes on:

let _ =
  if x && try () with _ -> () then ()

when .ocamlformat contains

ocp-indent-compat
Julow commented 7 months ago

Thanks for the report. The bug doesn't occur on the main branch, could you check ? This seems to be fixed since #2445.

nojb commented 7 months ago

Thanks for the report. The bug doesn't occur on the main branch, could you check ? This seems to be fixed since #2445.

I tried master but now I got another BUG :)

let _ =
  try
    ()
  with _ ->
    (match () with _ -> ())

with

indicate-multiline-delimiters=closing-on-separate-line
nojb commented 7 months ago

And another:

let _ =
  try () with _ ->
  try () with _ -> () in
()

also with

indicate-multiline-delimiters=closing-on-separate-line
Julow commented 7 months ago

Thanks! This is hopefully a recent bug. Should be fixed in https://github.com/ocaml-ppx/ocamlformat/pull/2537

nojb commented 7 months ago

Thanks! This is hopefully a recent bug. Should be fixed in #2537

Thanks, this fixes it indeed, and the original bug reported is fixed in master already. Closing. Thanks!

Julow commented 7 months ago

Thanks for checking.