ocaml-ppx / ocamlformat

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

Bug: Unecessary parentheses in types with attributes #2520

Open Julow opened 9 months ago

Julow commented 9 months ago

Describe the bug

Parentheses around types with attributes can be skipped in some cases. Spotted in https://github.com/ocaml-ppx/ocamlformat/pull/2519

let _ : (foo[@attr]) = ()

Ideally, Ast.parenze_typ would take attributes into account and fmt_core_type wouldn't apply parentheses unconditionally.