Skip to content

Commit

Permalink
Add missing break after if-then-else keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot authored and Julow committed Jan 16, 2024
1 parent 8418244 commit 7f87a4e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
4 changes: 1 addition & 3 deletions lib/Params.ml
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,7 @@ let get_if_then_else (c : Conf.t) ~first ~last ~parens_bch ~parens_prev_bch
( fmt_or_k first
(str "if" $ fmt_opt fmt_extension_suffix)
(str "else if")
$ fmt_attributes
$ fmt_or (Option.is_some fmt_extension_suffix) "@ " " "
$ fmt_cond xcnd )
$ fmt_attributes $ fmt "@ " $ fmt_cond xcnd )
$ fmt "@ " )
; box_keyword_and_expr=
(fun k -> hvbox 2 (fmt_or (Option.is_some xcond) "then" "else" $ k))
Expand Down
15 changes: 9 additions & 6 deletions test/passing/tests/ite-kw_first.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ f
;;

f
( if and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
( if
and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
then ()
else () )

Expand Down Expand Up @@ -164,10 +165,12 @@ let _ =
xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz

let _ =
if (* foo *)
foo
if
(* foo *)
foo
then 0
else if (* bar *)
bar
else if
(* bar *)
bar
then 1
else 2
15 changes: 9 additions & 6 deletions test/passing/tests/ite-kw_first_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ f
;;

f
( if and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
( if
and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
then ()
else ()
)
Expand Down Expand Up @@ -179,10 +180,12 @@ let _ =
xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz

let _ =
if (* foo *)
foo
if
(* foo *)
foo
then 0
else if (* bar *)
bar
else if
(* bar *)
bar
then 1
else 2
15 changes: 9 additions & 6 deletions test/passing/tests/ite-kw_first_no_indicate.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ f
;;

f
(if and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
(if
and_ even
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger
then ()
else ())

Expand Down Expand Up @@ -163,10 +164,12 @@ let _ =
xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz

let _ =
if (* foo *)
foo
if
(* foo *)
foo
then 0
else if (* bar *)
bar
else if
(* bar *)
bar
then 1
else 2

0 comments on commit 7f87a4e

Please sign in to comment.