From 89d6a2094b12764a42576f1008d5e0178f6f4bd0 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Tue, 3 Nov 2020 16:29:06 +0100 Subject: [PATCH] change or-pattern printing to use spaces instead of cuts (A p1 | B p2 | C p3) instead of (A p1|B p2|C p3) --- parsing/pprintast.ml | 2 +- .../tests/formatting/test_locations.dlocations.ocamlc.reference | 2 +- .../formatting/test_locations.dno-locations.ocamlc.reference | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parsing/pprintast.ml b/parsing/pprintast.ml index 21c62a1f2..f2b49de79 100644 --- a/parsing/pprintast.ml +++ b/parsing/pprintast.ml @@ -416,7 +416,7 @@ and pattern_or ctxt f x = | [] -> assert false | [x] -> pattern1 ctxt f x | orpats -> - pp f "@[%a@]" (list ~sep:"@,|" (pattern1 ctxt)) orpats + pp f "@[%a@]" (list ~sep:"@ | " (pattern1 ctxt)) orpats and pattern1 ctxt (f:Format.formatter) (x:pattern) : unit = let rec pattern_list_helper f = function diff --git a/testsuite/tests/formatting/test_locations.dlocations.ocamlc.reference b/testsuite/tests/formatting/test_locations.dlocations.ocamlc.reference index f17a66947..33368c574 100644 --- a/testsuite/tests/formatting/test_locations.dlocations.ocamlc.reference +++ b/testsuite/tests/formatting/test_locations.dlocations.ocamlc.reference @@ -78,7 +78,7 @@ ] ] -let rec fib = function | 0|1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2)) +let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2)) [ structure_item (test_locations.ml[17,534+0]..test_locations.ml[19,572+34]) Tstr_value Rec diff --git a/testsuite/tests/formatting/test_locations.dno-locations.ocamlc.reference b/testsuite/tests/formatting/test_locations.dno-locations.ocamlc.reference index f217a51f2..60351f717 100644 --- a/testsuite/tests/formatting/test_locations.dno-locations.ocamlc.reference +++ b/testsuite/tests/formatting/test_locations.dno-locations.ocamlc.reference @@ -78,7 +78,7 @@ ] ] -let rec fib = function | 0|1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2)) +let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2)) [ structure_item Tstr_value Rec