Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/Params.ml
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,15 @@ let get_if_then_else (c : Conf.t) ~cmts_before_opt ~pro ~first ~last
| _ -> 0 )
; cond= cond ()
; box_keyword_and_expr= Fn.id
; branch_pro= branch_pro ~begin_end_offset:0 ()
; branch_pro=
( if
(not has_beginend) && (not has_cmts_after_kw)
&& not (Location.is_single_line expr_loc c.fmt_opts.margin.v)
then
match cmts_before_opt xbch.ast.pexp_loc with
| Some cmts -> break 1000 2 $ cmts
| None -> branch_pro ~begin_end_offset:0 ()
else branch_pro ~begin_end_offset:0 () )
; wrap_parens=
wrap_parens
~wrap_breaks:
Expand Down
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-compact.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-compact_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
9 changes: 9 additions & 0 deletions test/passing/refs.ahrefs/ite-fit_or_vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.ahrefs/ite-kr.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.ahrefs/ite-kr_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-kw_first.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-kw_first_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-kw_first_no_indicate.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite-no_indicate.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
9 changes: 9 additions & 0 deletions test/passing/refs.ahrefs/ite-vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
8 changes: 8 additions & 0 deletions test/passing/refs.ahrefs/ite.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-compact.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-compact_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
9 changes: 9 additions & 0 deletions test/passing/refs.default/ite-fit_or_vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.default/ite-fit_or_vertical_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.default/ite-kr.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
9 changes: 9 additions & 0 deletions test/passing/refs.default/ite-kr_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,12 @@ let () =
()
end else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-kw_first.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-kw_first_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-kw_first_no_indicate.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite-no_indicate.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
9 changes: 9 additions & 0 deletions test/passing/refs.default/ite-vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,12 @@ let () =
end
else
()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else
2
8 changes: 8 additions & 0 deletions test/passing/refs.default/ite.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ let () =
()
end
else ()

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t
then
(* comment *)
1
else 2
8 changes: 8 additions & 0 deletions test/passing/refs.janestreet/ite-compact.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,11 @@ let () =
()
else ()
;;

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t then
(* comment *)
1
else 2
;;
8 changes: 8 additions & 0 deletions test/passing/refs.janestreet/ite-compact_closing.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,11 @@ let () =
()
else ()
;;

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t then
(* comment *)
1
else 2
;;
9 changes: 9 additions & 0 deletions test/passing/refs.janestreet/ite-fit_or_vertical.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,12 @@ let () =
else
()
;;

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t then
(* comment *)
1
else
2
;;
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,12 @@ let () =
else
()
;;

(* Long condition with comment after then keyword *)
let test =
if long_function_name_to_force_break a b c d e f g h i j k l m n o p q r s t then
(* comment *)
1
else
2
;;
Loading
Loading