Skip to content

Fix break-separators=after-and-docked for lists and arrays#931

Merged
gpetiot merged 6 commits intoocaml-ppx:masterfrom
gpetiot:list-sep-after-and-docked
Jul 26, 2019
Merged

Fix break-separators=after-and-docked for lists and arrays#931
gpetiot merged 6 commits intoocaml-ppx:masterfrom
gpetiot:list-sep-after-and-docked

Conversation

@gpetiot
Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot commented Jul 23, 2019

Fix #835 and another step towards fixing #925.
Lists and arrays have to be tackled together because they both rely on the fmt_expressions function.
No regressions with test_branch, the diff below is actually a fix when break-collection-expressions=wrap:

diff --git a/sledge/src/import/import.ml b/sledge/src/import/import.ml
index 8380d79df..80613788c 100644
--- a/sledge/src/import/import.ml
+++ b/sledge/src/import/import.ml
@@ -118,8 +118,7 @@ module Invariant = struct
               (Error.create_s
                  (Base.Sexp.message "invariant failed"
                     [ ("", Source_code_position.sexp_of_t here)
-                    ; ("exn", sexp_of_exn exn)
-                    ; ("", sexp_of_t t) ])) in
+                    ; ("exn", sexp_of_exn exn); ("", sexp_of_t t) ])) in
           Caml.Printexc.raise_with_backtrace exn bt ) ;
       true )
 end
diff --git a/sledge/src/sledge_buck.ml b/sledge/src/sledge_buck.ml
index b7a05d911..306d6ba29 100644
--- a/sledge/src/sledge_buck.ml
+++ b/sledge/src/sledge_buck.ml
@@ -38,9 +38,8 @@ let buck_build ~context target =
   let open Process in
   eval ~context
     (run "buck"
-       [ "build"
-       ; "@mode/" ^ Lazy.force mode
-       ; "-c"; "sledge.build=True"; target ])
+       [ "build"; "@mode/" ^ Lazy.force mode; "-c"; "sledge.build=True"
+       ; target ])
 
 (* split a fully-qualified buck target into file and rule *)
 let parse_target target =
diff --git a/sledge/src/symbheap/exec.ml b/sledge/src/symbheap/exec.ml
index 8f9350764..68791079d 100644
--- a/sledge/src/symbheap/exec.ml
+++ b/sledge/src/symbheap/exec.ml
@@ -191,10 +191,8 @@ let memmov_up_spec us dst src len =
   {xs; foot; post}
 
 let memmov_specs us dst src len =
-  [ memmov_eq_spec us dst src len
-  ; memmov_dj_spec us dst src len
-  ; memmov_dn_spec us dst src len
-  ; memmov_up_spec us dst src len ]
+  [ memmov_eq_spec us dst src len; memmov_dj_spec us dst src len
+  ; memmov_dn_spec us dst src len; memmov_up_spec us dst src len ]
 
diff --git a/sledge/src/symbheap/solver.ml b/sledge/src/symbheap/solver.ml
index 7566ba70f..adfc38136 100644
--- a/sledge/src/symbheap/solver.ml
+++ b/sledge/src/symbheap/solver.ml
@@ -270,8 +270,7 @@ let excise_seg_sub_infix ({us; com; min; xs; sub; zs} as goal) msg ssg l_k
       (Exp.eq
          (Exp.memory ~siz:o ~arr:a)
          (Exp.concat
-            [| Exp.memory ~siz:l_k ~arr:a0
-             ; Exp.memory ~siz:n ~arr:a1
+            [| Exp.memory ~siz:l_k ~arr:a0; Exp.memory ~siz:n ~arr:a1
              ; Exp.memory ~siz:ko_ln ~arr:a2 |]))
       (Sh.star
          (Sh.seg {loc= k; bas= b; len= m; siz= l_k; arr= a0})
@@ -410,8 +409,7 @@ let excise_seg_min_infix ({us; com; min; xs; sub; zs} as goal) msg ssg k_l
          (Sh.and_
             (Exp.eq
                (Exp.concat
-                  [| Exp.memory ~siz:k_l ~arr:a0'
-                   ; Exp.memory ~siz:o ~arr:a
+                  [| Exp.memory ~siz:k_l ~arr:a0'; Exp.memory ~siz:o ~arr:a
                    ; Exp.memory ~siz:ln_ko ~arr:a2' |])
                (Exp.memory ~siz:n ~arr:a'))

@gpetiot gpetiot changed the title [WIP] Fix break-separators=after-and-docked for lists and arrays Fix break-separators=after-and-docked for lists and arrays Jul 23, 2019
@gpetiot gpetiot requested a review from Julow July 23, 2019 09:15
Copy link
Copy Markdown
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great improvement !

@gpetiot gpetiot merged commit f06fc10 into ocaml-ppx:master Jul 26, 2019
@gpetiot gpetiot deleted the list-sep-after-and-docked branch July 26, 2019 04:30
bogdan2412 pushed a commit to bogdan2412/ocamlformat that referenced this pull request Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete implementation of break-cases=after-and-docked

3 participants