Skip to content

Commit

Permalink
Avoid breaking after a lone '}'
Browse files Browse the repository at this point in the history
  • Loading branch information
Julow committed Nov 12, 2024
1 parent bed630f commit 2adb89c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Fmt_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,15 @@ and fmt_pattern_attributes c xpat k =
false
| _ -> true )
in
hvbox_if parens_attr 1
let box =
match xpat.ast.ppat_desc with
| (Ppat_record _ | Ppat_array _ | Ppat_list _)
when c.conf.fmt_opts.dock_collection_brackets.v ->
hovbox
| _ -> hvbox
in
box
(if parens_attr then 1 else 0)
(Params.parens_if parens_attr c.conf
(k $ fmt_attributes c ~pre:Space attrs) )

Expand Down
8 changes: 8 additions & 0 deletions test/passing/tests/record-402.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ let _ =
()
in
()

let foo
({ foooooooooooooooooooooo
; invalidation_trace
; access_trace
; must_be_valid_reason }
[@warning "+missing-record-field-pattern"] ) =
()
9 changes: 9 additions & 0 deletions test/passing/tests/record-default.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ let _ =
()
in
()

let foo
({
foooooooooooooooooooooo;
invalidation_trace;
access_trace;
must_be_valid_reason;
} [@warning "+missing-record-field-pattern"]) =
()
8 changes: 8 additions & 0 deletions test/passing/tests/record-loose.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ let _ =
()
in
()

let foo
({ foooooooooooooooooooooo
; invalidation_trace
; access_trace
; must_be_valid_reason }
[@warning "+missing-record-field-pattern"] ) =
()
8 changes: 8 additions & 0 deletions test/passing/tests/record-tight_decl.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ let _ =
()
in
()

let foo
({ foooooooooooooooooooooo
; invalidation_trace
; access_trace
; must_be_valid_reason }
[@warning "+missing-record-field-pattern"] ) =
()
9 changes: 9 additions & 0 deletions test/passing/tests/record.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,12 @@ let _ =
()
in
()

let foo
({
foooooooooooooooooooooo;
invalidation_trace;
access_trace;
must_be_valid_reason;
} [@warning "+missing-record-field-pattern"]) =
()
8 changes: 8 additions & 0 deletions test/passing/tests/record.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ let _ =
()
in
()

let foo
({ foooooooooooooooooooooo
; invalidation_trace
; access_trace
; must_be_valid_reason }
[@warning "+missing-record-field-pattern"] ) =
()

0 comments on commit 2adb89c

Please sign in to comment.