Skip to content

Commit 143a0cf

Browse files
committed
Minor fix
1 parent 811201b commit 143a0cf

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

lib/text_diff.ml

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,11 @@ and process_cstr_diff name cstr_diff =
447447
let record_hunks = process_record_type_diff record_diff in
448448
Inline_hunks (Icommon (Printf.sprintf "| %s of " name) :: record_hunks)
449449
| Tuple_cstr tuple_diff ->
450-
let tuple_hunks = process_cstr_tuple_diff tuple_diff in
450+
let tuple_hunks = process_tuple_type_diff tuple_diff in
451451
Inline_hunks (Icommon (Printf.sprintf "| %s of " name) :: tuple_hunks)
452452
)
453453

454-
and process_cstr_tuple_diff diff =
454+
and process_tuple_type_diff diff =
455455
let module S = Stddiff in
456456
List.mapi
457457
(fun i te_diff ->
@@ -475,35 +475,6 @@ and process_cstr_tuple_diff diff =
475475
diff
476476
|> List.concat
477477

478-
and process_tuple_type_diff ~paren tuple_diff =
479-
let module S = Stddiff in
480-
let tuple_hunks =
481-
List.mapi
482-
(fun i te_diff ->
483-
let star = if i > 0 then " * " else "" in
484-
match te_diff with
485-
| S.Same same_te ->
486-
[
487-
Icommon (Printf.sprintf "%s%s" star (type_expr_to_string same_te));
488-
]
489-
| Changed (Stddiff.Added te) ->
490-
[
491-
Iconflict
492-
{ iorig = None; inew = Some (star ^ type_expr_to_string te) };
493-
]
494-
| Changed (Removed te) ->
495-
[
496-
Iconflict
497-
{ iorig = Some (star ^ type_expr_to_string te); inew = None };
498-
]
499-
| Changed (Modified te) ->
500-
let te_hunks = process_type_expr_diff ~paren:true te in
501-
if i > 0 then Icommon " * " :: te_hunks else te_hunks)
502-
tuple_diff
503-
|> List.concat
504-
in
505-
if paren then (Icommon "(" :: tuple_hunks) @ [ Icommon ")" ] else tuple_hunks
506-
507478
and process_type_expr_diff ?(paren = true) (diff : Diff.type_expr) :
508479
inline_hunk list =
509480
match diff with
@@ -515,7 +486,10 @@ and process_type_expr_diff ?(paren = true) (diff : Diff.type_expr) :
515486
inew = Some (type_expr_to_string current);
516487
};
517488
]
518-
| Tuple tuple_diff -> process_tuple_type_diff ~paren tuple_diff
489+
| Tuple tuple_diff ->
490+
let tuple_hunks = process_tuple_type_diff tuple_diff in
491+
if paren then (Icommon "(" :: tuple_hunks) @ [ Icommon ")" ]
492+
else tuple_hunks
519493

520494
and cstr_args_to_line cstr_args =
521495
match cstr_args with

0 commit comments

Comments
 (0)