Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix position of expressions regarding of comments in infix-op expressions #986

Merged
merged 23 commits into from
Aug 29, 2019

Conversation

gpetiot
Copy link
Collaborator

@gpetiot gpetiot commented Aug 27, 2019

Alternative fix to #961 (could replace #970)

It is enough to review commit 6bceb0e, bf9b046 is the last exploitable base from the branch of PR #970

cc @craigfe for feedback

Diff with test_branch: (long but looks good)

diff --git a/infer/src/IR/Attributes.ml b/infer/src/IR/Attributes.ml
index 761e4679b..96c0e2aa0 100644
--- a/infer/src/IR/Attributes.ml
+++ b/infer/src/IR/Attributes.ml
@@ -103,7 +103,7 @@ let should_try_to_update pname_blob akind =
       SqliteUtils.result_single_column_option ~finalize:false ~log:"Attributes.replace" db
         find_stmt
       |> (* there is no entry with a strictly larger "definedness" for that proc name *)
-         Option.is_none)
+      Option.is_none)
 
 
 let select_statement =
diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml
index 2587e399d..d268b7d54 100644
--- a/infer/src/backend/ondemand.ml
+++ b/infer/src/backend/ondemand.ml
@@ -265,7 +265,7 @@ let dump_duplicate_procs source_file procs =
           when (* defined in another file *)
                (not (SourceFile.equal source_file translation_unit))
                && (* really defined in that file and not in an include *)
-                  SourceFile.equal translation_unit loc.file ->
+               SourceFile.equal translation_unit loc.file ->
             Some (pname, translation_unit)
         | _ ->
             None)
diff --git a/infer/src/biabduction/Abs.ml b/infer/src/biabduction/Abs.ml
index 3bedc6414..84316bb64 100644
--- a/infer/src/biabduction/Abs.ml
+++ b/infer/src/biabduction/Abs.ml
@@ -90,8 +90,8 @@ let create_condition_ls ids_private id_base p_leftover (inst : Sil.subst) =
   (* [fav_insts_of_private_ids] does not intersect the free vars in [p_leftover.sigma] *)
   Prop.sigma_free_vars p_leftover.Prop.sigma |> Fn.non intersects_fav_insts_of_private_ids
   && (* [fav_insts_of_private_ids] does not intersect the free vars in [insts_of_public_ids] *)
-     List.for_all insts_of_public_ids ~f:(fun e ->
-         Exp.free_vars e |> Fn.non intersects_fav_insts_of_private_ids)
+  List.for_all insts_of_public_ids ~f:(fun e ->
+      Exp.free_vars e |> Fn.non intersects_fav_insts_of_private_ids)
 
 
 let mk_rule_ptspts_ls tenv impl_ok1 impl_ok2 (para : Sil.hpara) =
@@ -912,7 +912,7 @@ let abstract_gc tenv p =
   let check fav_seq =
     Sequence.is_empty fav_seq
     || (* non-empty intersection with [fav_p_without_pi] *)
-       Sequence.exists fav_seq ~f:(fun id -> Ident.Set.mem id fav_p_without_pi)
+    Sequence.exists fav_seq ~f:(fun id -> Ident.Set.mem id fav_p_without_pi)
   in
   let strong_filter = function
     | Sil.Aeq (e1, e2) | Sil.Aneq (e1, e2) ->
@@ -1114,7 +1114,7 @@ let check_junk pname tenv prop =
               in
               (is_none alloc_attribute && !leaks_reported <> [])
               || (* None attribute only reported if it's the first one *)
-                 List.mem ~equal:attr_opt_equal !leaks_reported alloc_attribute
+              List.mem ~equal:attr_opt_equal !leaks_reported alloc_attribute
             in
             let ignore_leak =
               !BiabductionConfig.allow_leak || ignore_resource || is_undefined
diff --git a/infer/src/biabduction/BuiltinDefn.ml b/infer/src/biabduction/BuiltinDefn.ml
index f2122d6aa..64f38f837 100644
--- a/infer/src/biabduction/BuiltinDefn.ml
+++ b/infer/src/biabduction/BuiltinDefn.ml
@@ -514,12 +514,12 @@ let execute_free mk ?(mark_as_freed = true) {Builtin.summary; instr; tenv; prop_
       let plist =
         prop_zero
         @ (* model: if 0 then skip else execute_free_nonzero_ *)
-          List.concat_map
-            ~f:(fun p ->
-              execute_free_nonzero_ mk ~mark_as_freed (Summary.get_proc_desc summary) tenv instr p
-                (Prop.exp_normalize_prop tenv p lexp)
-                typ loc)
-            prop_nonzero
+        List.concat_map
+          ~f:(fun p ->
+            execute_free_nonzero_ mk ~mark_as_freed (Summary.get_proc_desc summary) tenv instr p
+              (Prop.exp_normalize_prop tenv p lexp)
+              typ loc)
+          prop_nonzero
       in
       List.map ~f:(fun p -> (p, path)) plist
   | _ ->
diff --git a/infer/src/biabduction/Rearrange.ml b/infer/src/biabduction/Rearrange.ml
index ed9729a30..aa301e1e7 100644
--- a/infer/src/biabduction/Rearrange.ml
+++ b/infer/src/biabduction/Rearrange.ml
@@ -44,7 +44,7 @@ let check_bad_index tenv pname p len index loc =
     let index_nonnegative = Prop.mk_inequality tenv (Exp.BinOp (Binop.Le, Exp.zero, index)) in
     Prover.check_zero tenv index
     || (* index 0 always in bound, even when we know nothing about len *)
-       (Prover.check_atom tenv p index_not_too_large && Prover.check_atom tenv p index_nonnegative)
+    (Prover.check_atom tenv p index_not_too_large && Prover.check_atom tenv p index_nonnegative)
   in
   let index_has_bounds () =
     match Prover.get_bounds tenv p index with Some _, Some _ -> true | _ -> false
@@ -919,9 +919,9 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
          | _ ->
              false )
       || (* or the prop says we already have the lock *)
-         List.exists
-           ~f:(function Sil.Apred (Alocked, _) -> true | _ -> false)
-           (Attribute.get_for_exp tenv prop guarded_by_exp)
+      List.exists
+        ~f:(function Sil.Apred (Alocked, _) -> true | _ -> false)
+        (Attribute.get_for_exp tenv prop guarded_by_exp)
     in
     let guardedby_is_self_referential =
       String.equal "itself" (String.lowercase guarded_by_str)
diff --git a/infer/src/bufferoverrun/bufferOverrunProofObligations.ml b/infer/src/bufferoverrun/bufferOverrunProofObligations.ml
index 8951ec2b4..5e1de3f65 100644
--- a/infer/src/bufferoverrun/bufferOverrunProofObligations.ml
+++ b/infer/src/bufferoverrun/bufferOverrunProofObligations.ml
@@ -337,22 +337,22 @@ module ArrayAccessCondition = struct
     (* basically, alarms involving infinity are filtered *)
     ((not (ItvPure.is_finite real_idx)) || not (ItvPure.is_finite c.size))
     && (* except the following cases *)
-       not
-         ( Bound.is_not_infty (ItvPure.lb real_idx)
-           && (* idx non-infty lb < 0 *)
-              Bound.lt (ItvPure.lb real_idx) Bound.zero
-         || Bound.is_not_infty (ItvPure.lb real_idx)
-            && (* idx non-infty lb > size lb *)
-               Bound.gt (ItvPure.lb real_idx) (ItvPure.lb c.size)
-         || Bound.is_not_infty (ItvPure.lb real_idx)
-            && (* idx non-infty lb > size ub *)
-               Bound.gt (ItvPure.lb real_idx) (ItvPure.ub c.size)
-         || Bound.is_not_infty (ItvPure.ub real_idx)
-            && (* idx non-infty ub > size lb *)
-               Bound.gt (ItvPure.ub real_idx) (ItvPure.lb c.size)
-         || Bound.is_not_infty (ItvPure.ub real_idx)
-            && (* idx non-infty ub > size ub *)
-               Bound.gt (ItvPure.ub real_idx) (ItvPure.ub c.size) )
+    not
+      ( Bound.is_not_infty (ItvPure.lb real_idx)
+        && (* idx non-infty lb < 0 *)
+        Bound.lt (ItvPure.lb real_idx) Bound.zero
+      || Bound.is_not_infty (ItvPure.lb real_idx)
+         && (* idx non-infty lb > size lb *)
+         Bound.gt (ItvPure.lb real_idx) (ItvPure.lb c.size)
+      || Bound.is_not_infty (ItvPure.lb real_idx)
+         && (* idx non-infty lb > size ub *)
+         Bound.gt (ItvPure.lb real_idx) (ItvPure.ub c.size)
+      || Bound.is_not_infty (ItvPure.ub real_idx)
+         && (* idx non-infty ub > size lb *)
+         Bound.gt (ItvPure.ub real_idx) (ItvPure.lb c.size)
+      || Bound.is_not_infty (ItvPure.ub real_idx)
+         && (* idx non-infty ub > size ub *)
+         Bound.gt (ItvPure.ub real_idx) (ItvPure.ub c.size) )
 
 
   (* check buffer overrun and return its confidence *)
diff --git a/infer/src/checkers/Litho.ml b/infer/src/checkers/Litho.ml
index 4ecdeb061..c0ea53aeb 100644
--- a/infer/src/checkers/Litho.ml
+++ b/infer/src/checkers/Litho.ml
@@ -97,7 +97,7 @@ module RequiredProps = struct
         ~f:(fun ({Annot.class_name; parameters}, _) ->
           String.is_suffix class_name ~suffix:Annotations.prop
           && (* Don't count as required if it's @Prop(optional = true) *)
-             not (List.exists ~f:(fun annot_string -> String.equal annot_string "true") parameters))
+          not (List.exists ~f:(fun annot_string -> String.equal annot_string "true") parameters))
         annot_list
     in
     match Tenv.lookup tenv typename with
@@ -227,8 +227,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
           (* track Builder's in order to check required prop's *)
           || GraphQLGetters.is_function callee_procname domain_summary
           || (* track GraphQL getters in order to report graphql field accesses *)
-             Domain.mem receiver astate
-             (* track anything called on a receiver we're already tracking *) )
+          Domain.mem receiver astate
+          (* track anything called on a receiver we're already tracking *) )
           && (not (Typ.Procname.Java.is_static java_callee_procname))
           && not
                ( LithoFramework.is_function callee_procname
diff --git a/infer/src/checkers/NullabilityPreanalysis.ml b/infer/src/checkers/NullabilityPreanalysis.ml
index 3010bd572..e926173ef 100644
--- a/infer/src/checkers/NullabilityPreanalysis.ml
+++ b/infer/src/checkers/NullabilityPreanalysis.ml
@@ -49,7 +49,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
       | Typ.Tptr ({desc= Tfun _}, _)
         when Typ.is_objc_class typ && is_self proc_data.extras lhs_id
              && (* lhs is self, rhs is not null *)
-                not (exp_is_null proc_data.extras rhs) ->
+             not (exp_is_null proc_data.extras rhs) ->
           FieldsAssignedInConstructors.add (name, typ) astate
       | _ ->
           astate )
diff --git a/infer/src/checkers/Siof.ml b/infer/src/checkers/Siof.ml
index dec7fa0bf..2c7b18eb0 100644
--- a/infer/src/checkers/Siof.ml
+++ b/infer/src/checkers/Siof.ml
@@ -198,11 +198,11 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
         add_actuals_globals astate summary loc actuals
         annot_list
     in
     match Tenv.lookup tenv typename with
@@ -227,8 +227,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
           (* track Builder's in order to check required prop's *)
           || GraphQLGetters.is_function callee_procname domain_summary
           || (* track GraphQL getters in order to report graphql field accesses
 *)
-             Domain.mem receiver astate
-             (* track anything called on a receiver we're already tracking *) )
+          Domain.mem receiver astate
+          (* track anything called on a receiver we're already tracking *) )
           && (not (Typ.Procname.Java.is_static java_callee_procname))
           && not
                ( LithoFramework.is_function callee_procname
diff --git a/infer/src/checkers/NullabilityPreanalysis.ml b/infer/src/checkers/N
ullabilityPreanalysis.ml
index 3010bd572..e926173ef 100644
--- a/infer/src/checkers/NullabilityPreanalysis.ml
+++ b/infer/src/checkers/NullabilityPreanalysis.ml
@@ -49,7 +49,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
       | Typ.Tptr ({desc= Tfun _}, _)
         when Typ.is_objc_class typ && is_self proc_data.extras lhs_id
              && (* lhs is self, rhs is not null *)
-                not (exp_is_null proc_data.extras rhs) ->
+             not (exp_is_null proc_data.extras rhs) ->
           FieldsAssignedInConstructors.add (name, typ) astate
       | _ ->
           astate )
diff --git a/infer/src/checkers/Siof.ml b/infer/src/checkers/Siof.ml
index dec7fa0bf..2c7b18eb0 100644
--- a/infer/src/checkers/Siof.ml
+++ b/infer/src/checkers/Siof.ml
@@ -198,11 +198,11 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
         add_actuals_globals astate summary loc actuals
         |> Domain.join callee_astate
         |> (* make sure it's not Bottom: we made a function call so this needs initialization *)
-           at_least_nonbottom
+        at_least_nonbottom
     | Call (_, _, actuals, loc, _) ->
         add_actuals_globals astate summary loc actuals
         |> (* make sure it's not Bottom: we made a function call so this needs initialization *)
-           at_least_nonbottom
+        at_least_nonbottom
     | Metadata _ ->
         astate
 
diff --git a/infer/src/checkers/hoisting.ml b/infer/src/checkers/hoisting.ml
index 85aa9d21d..1b8a2f123 100644
--- a/infer/src/checkers/hoisting.ml
+++ b/infer/src/checkers/hoisting.ml
@@ -39,7 +39,7 @@ let add_if_hoistable inv_vars instr node source_nodes idom hoistable_calls =
     when (* Check condition (1); N dominates all loop sources *)
          List.for_all ~f:(fun source -> Dominators.dominates idom node source) source_nodes
          && (* Check condition (2); id should be invariant already *)
-            LoopInvariant.InvariantVars.mem (Var.of_id ret_id) inv_vars ->
+         LoopInvariant.InvariantVars.mem (Var.of_id ret_id) inv_vars ->
       HoistCalls.add {pname; loc; node; params; ret} hoistable_calls
   | _ ->
       hoistable_calls
diff --git a/infer/src/checkers/loopInvariant.ml b/infer/src/checkers/loopInvariant.ml
index e67d4a297..350f73938 100644
--- a/infer/src/checkers/loopInvariant.ml
+++ b/infer/src/checkers/loopInvariant.ml
@@ -61,7 +61,7 @@ let is_def_unique_and_satisfy tenv var (loop_nodes : LoopNodes.t) ~is_pure_by_de
                PurityDomain.is_pure
                  (get_purity tenv ~is_pure_by_default ~get_callee_purity callee_pname)
                && (* check if all params are invariant *)
-                  List.for_all ~f:(fun (exp, _) -> is_exp_invariant exp) args
+               List.for_all ~f:(fun (exp, _) -> is_exp_invariant exp) args
            | _ ->
                false)
   | _ ->
diff --git a/infer/src/clang/ClangCommand.ml b/infer/src/clang/ClangCommand.ml
index 6fb79dca4..a0226802b 100644
--- a/infer/src/clang/ClangCommand.ml
+++ b/infer/src/clang/ClangCommand.ml
@@ -202,7 +202,7 @@ let clang_cc1_cmd_sanitizer cmd =
        are appended at the end to override previous opposite settings.  How it's done: suppress
        all the warnings, since there are no warnings, compiler can't elevate them to error
        level. *)
-       argv_cons "-Wno-everything"
+    argv_cons "-Wno-everything"
   in
   let clang_arguments =
     filter_and_replace_unsupported_args ~replace_options_arg ~post_args:(List.rev post_args_rev)
@@ -247,7 +247,7 @@ let with_plugin_args args =
   let args_before_rev =
     []
     |> (* -cc1 has to be the first argument or clang will think it runs in driver mode *)
-       argv_cons "-cc1"
+    argv_cons "-cc1"
     |> List.rev_append
          [ "-load"
          ; plugin_path
diff --git a/infer/src/clang/ClangWrapper.ml b/infer/src/clang/ClangWrapper.ml
index 450b693b3..c7dde556c 100644
--- a/infer/src/clang/ClangWrapper.ml
+++ b/infer/src/clang/ClangWrapper.ml
@@ -72,14 +72,14 @@ let clang_driver_action_items : ClangCommand.t -> action_item list =
            reason that flag is the only one to show up *after* the source file name in the -cc1
            commands emitted by [clang -### ...]. Passing [-fno-addrsig] ensures that the source
            path is always the last argument.  *)
-         ClangCommand.append_args
-           [ "-fno-cxx-modules"
-           ; "-Qunused-arguments"
-           ; "-Wno-ignored-optimization-argument"
-           ; "-fno-addrsig" ]
+      ClangCommand.append_args
+        [ "-fno-cxx-modules"
+        ; "-Qunused-arguments"
+        ; "-Wno-ignored-optimization-argument"
+        ; "-fno-addrsig" ]
       |> (* If -fembed-bitcode is passed, it leads to multiple cc1 commands, which try to read .bc
             files that don't get generated, and fail. So pass -fembed-bitcode=off to disable. *)
-         ClangCommand.append_args ["-fembed-bitcode=off"]
+      ClangCommand.append_args ["-fembed-bitcode=off"]
       |> ClangCommand.command_to_run )
   in
   L.(debug Capture Medium) "clang -### invocation: %s@\n" clang_hashhashhash ;
@@ -89,8 +89,9 @@ let clang_driver_action_items : ClangCommand.t -> action_item list =
       CanonicalCommand
         ( (* massage line to remove edge-cases for splitting *)
         match
-          "\"" ^ line ^ " \"" |> (* split by whitespace *)
-                                 Str.split (Str.regexp_string "\" \"")
+          "\"" ^ line ^ " \""
+          |> (* split by whitespace *)
+          Str.split (Str.regexp_string "\" \"")
         with
         | prog :: args ->
             ClangCommand.mk ~is_driver:false ClangQuotes.EscapedDoubleQuotes ~prog ~args
diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml
index 80041478a..3873f056a 100644
--- a/infer/src/clang/cTrans.ml
+++ b/infer/src/clang/cTrans.ml
@@ -2317,7 +2317,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
           if
             is_var_unused
             || (* variable might be initialized already - do nothing in that case*)
-               List.exists ~f:(Exp.equal var_exp) res_trans_ie.control.initd_exps
+            List.exists ~f:(Exp.equal var_exp) res_trans_ie.control.initd_exps
           then None
           else
             let sil_e1', ie_typ = res_trans_ie.return in
diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvation.ml
index 6ca11481f..2369eaddd 100644
--- a/infer/src/concurrency/starvation.ml
+++ b/infer/src/concurrency/starvation.ml
@@ -89,8 +89,9 @@ let clang_driver_action_items : ClangCommand.t -> action_item 
list =
       CanonicalCommand
         ( (* massage line to remove edge-cases for splitting *)
         match
-          "\"" ^ line ^ " \"" |> (* split by whitespace *)
-                                 Str.split (Str.regexp_string "\" \"")
+          "\"" ^ line ^ " \""
+          |> (* split by whitespace *)
+          Str.split (Str.regexp_string "\" \"")
         with
         | prog :: args ->
             ClangCommand.mk ~is_driver:false ClangQuotes.EscapedDoubleQuotes ~p
rog ~args
diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml
index 80041478a..3873f056a 100644
--- a/infer/src/clang/cTrans.ml
+++ b/infer/src/clang/cTrans.ml
@@ -2317,7 +2317,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule
_type.CTranslation = s
           if
             is_var_unused
             || (* variable might be initialized already - do nothing in that ca
se*)
-               List.exists ~f:(Exp.equal var_exp) res_trans_ie.control.initd_ex
ps
+            List.exists ~f:(Exp.equal var_exp) res_trans_ie.control.initd_exps
           then None
           else
             let sil_e1', ie_typ = res_trans_ie.return in
diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvat
ion.ml
index 6ca11481f..2369eaddd 100644
--- a/infer/src/concurrency/starvation.ml
+++ b/infer/src/concurrency/starvation.ml
@@ -310,9 +310,9 @@ let should_report_deadlock_on_current_proc current_elem endpoint_elem =
       c < 0
       || Int.equal 0 c
          && (* same class, so choose depending on location *)
-            Location.compare current_elem.Order.elem.eventually.Event.loc
-              endpoint_elem.Order.elem.eventually.Event.loc
-            < 0
+         Location.compare current_elem.Order.elem.eventually.Event.loc
+           endpoint_elem.Order.elem.eventually.Event.loc
+         < 0
 
 
 let should_report pdesc =
diff --git a/infer/src/integration/CaptureCompilationDatabase.ml b/infer/src/integration/CaptureCompilationDatabase.ml
index eebf31039..124d0cf23 100644
--- a/infer/src/integration/CaptureCompilationDatabase.ml
+++ b/infer/src/integration/CaptureCompilationDatabase.ml
@@ -83,8 +83,8 @@ let get_compilation_database_files_buck ~prog ~args =
       let build_args =
         (command :: List.rev_append rev_not_targets (List.rev Config.buck_build_args_no_inline))
         @ (* Infer doesn't support C++ modules nor precompiled headers yet (T35656509) *)
-          "--config" :: "*//cxx.pch_enabled=false" :: "--config" :: "*//cxx.modules_default=false"
-          :: "--config" :: "*//cxx.modules=False" :: targets_args
+        "--config" :: "*//cxx.pch_enabled=false" :: "--config" :: "*//cxx.modules_default=false"
+        :: "--config" :: "*//cxx.modules=False" :: targets_args
       in
       Logging.(debug Linters Quiet)
         "Processed buck command is: 'buck %a'@\n" (Pp.seq F.pp_print_string) build_args ;
diff --git a/compiler/lib/driver.ml b/compiler/lib/driver.ml
index dee8f58ee..870672728 100644
--- a/compiler/lib/driver.ml
+++ b/compiler/lib/driver.ml
@@ -99,11 +99,11 @@ let o1 : 'a -> 'a =
   >> tailcall
   >> flow_simple
   >> (* flow simple to keep information for future tailcall opt *)
-     specialize'
+  specialize'
   >> eval
   >> inline
   >> (* inlining may reveal new tailcall opt *)
-     deadcode
+  deadcode
   >> tailcall
   >> phi
   >> flow
@@ -133,11 +133,11 @@ let round1 : 'a -> 'a =
   >> tailcall
   >> inline
   >> (* inlining may reveal new tailcall opt *)
-     deadcode
+  deadcode
   >> (* deadcode required before flow simple -> provided by constant *)
-     flow_simple
+  flow_simple
   >> (* flow simple to keep information for future tailcall opt *)
-     specialize'
+  specialize'
   >> eval
   >> identity
 
diff --git a/compiler/lib/generate.ml b/compiler/lib/generate.ml
index 728cf7e7b..22c886acf 100644
--- a/compiler/lib/generate.ml
+++ b/compiler/lib/generate.ml
@@ -1835,9 +1835,9 @@ let generate_shared_value ctx =
             | None -> []
             | Some v ->
                 [J.V v, Some (J.EDot (s_var Constant.global_object, "jsoo_runtime"), J.N)])
-          @ List.map
-              (StringMap.bindings ctx.Ctx.share.Share.vars.Share.strings)
-              ~f:(fun (s, v) -> v, Some (str_js s, J.N))
+           @ List.map
+               (StringMap.bindings ctx.Ctx.share.Share.vars.Share.strings)
+               ~f:(fun (s, v) -> v, Some (str_js s, J.N))
            @ List.map
                (StringMap.bindings ctx.Ctx.share.Share.vars.Share.prims)
                ~f:(fun (s, v) -> v, Some (runtime_fun ctx s, J.N))))
diff --git a/lambda/matching.ml b/lambda/matching.ml
index 2a7b8858d..d3ee47b80 100644
--- a/lambda/matching.ml
+++ b/lambda/matching.ml
@@ -1093,12 +1093,12 @@ module Or_matrix = struct
       (* check append condition for head of O *)
       safe_below_or_matrix not_e (p, ps)
       && (* check insert condition for tail of O *)
-         List.for_all
-           (fun cl ->
-             match cl with
-             | q :: _, _ -> disjoint p q
-             | _ -> assert false)
-           seen
+      List.for_all
+        (fun cl ->
+          match cl with
+          | q :: _, _ -> disjoint p q
+          | _ -> assert false)
+        seen
     in
     let rec attempt seen = function
       (* invariant: the new clause is safe to append at the end of
@@ -3310,10 +3310,10 @@ let check_partial is_mutable is_lazy pat_act_list = function
       if
         pat_act_list = []
         || (* allow empty case list *)
-           List.exists
-             (fun (pats, lam) ->
-               is_mutable pats && (is_guarded lam || is_lazy pats))
-             pat_act_list
+        List.exists
+          (fun (pats, lam) ->
+            is_mutable pats && (is_guarded lam || is_lazy pats))
+          pat_act_list
       then
         Partial
       else

Copy link
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.

Definitely better than #970.

@gpetiot
Copy link
Collaborator Author

gpetiot commented Aug 28, 2019

I improved the case when the comment is before the operator:

let () =
  (* Open the repo *)
  initialise
  (* Perform a subsequent action *)
  >>= subsequent_action
  (* Keep going... *)
  >|= another_action
  (* And finally do this *)
  |> fun t -> final_action t

Copy link
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.

Looks good !
Fixes #961

@Julow Julow merged commit d82bc96 into ocaml-ppx:master Aug 29, 2019
@gpetiot gpetiot deleted the fmt-args2 branch August 29, 2019 13:29
Julow added a commit to Julow/opam-repository that referenced this pull request Nov 4, 2019
CHANGES:

#### Changes

  + Set "conventional" as the default profile (ocaml-ppx/ocamlformat#1060) (Guillaume Petiot)
    This new profile is made to better match the most used style and is encouraged.
    To continue using the previous default, use `profile = ocamlformat` in your `.ocamlformat`.
  + CLI: Allow both values of boolean options (ocaml-ppx/ocamlformat#1062) (Jules Aguillon)
    Now, both `--opt` and --no-opt` are available on the CLI for any boolean option "opt".
    Previously, only one of them were available depending on the default value.
  + Auto mode for `break-string-literals` (ocaml-ppx/ocamlformat#1057) (Guillaume Petiot)
    `wrap`, `newlines` and `newlines-and-wrap` values of `break-string-literals` are removed.
    `auto` replaces them, it is equivalent to `newlines-and-wrap`.
  + Dock collection brackets (ocaml-ppx/ocamlformat#1014) (Guillaume Petiot)
    `after-and-docked` value of `break-separators` is removed and is replaced by a new `dock-collection-brackets` option.
  + Preserve `begin` and `end` keywords in if-then-else (ocaml-ppx/ocamlformat#978) (Jules Aguillon)
    Previously, `begin`/`end` keywords around if-then-else branches were turned into parentheses.

#### New features

  + Give a hint when warning 50 is raised (ocaml-ppx/ocamlformat#1111) (Guillaume Petiot)
  + Add a message when a config value is removed (ocaml-ppx/ocamlformat#1089) (Etienne Millon)
    Explain what replaces removed options and avoid printing a parsing error.
  + Implement `sequence-blank-line=preserve-one` for let bindings (ocaml-ppx/ocamlformat#1077) (Jules Aguillon)
    Preserve a blank line after `let .. in` when `sequence-blank-line` set to `preserve-one`.
    Previously, only blank lines after `;` could be preserved.
  + Parse toplevel directives (ocaml-ppx/ocamlformat#1020) (Jules Aguillon)
    Allow `#directives` in `.ml` files.
    Previously, files containing a directive needed to be parsed as "use file".
    The "use file" mode is removed and `--use-file` is now the same as `--impl`.
  + Don't require `--name`, require kind, forbid `--inplace`, allow `--check`, make `--enable-outside-detected-project` implicit when reading from stdin (ocaml-ppx/ocamlformat#1018) (Guillaume Petiot)
  + Parse code in docstrings (ocaml-ppx/ocamlformat#941) (Guillaume Petiot)
    Format OCaml code in cinaps-style comments `(*$ code *)` and code blocks in documentation comments `(** {[ code ]} *)`.
  + Parse documentation comments with Odoc (ocaml-ppx/ocamlformat#721) (Jules Aguillon)
    Formatting of documentation comments is more robust and support newer Odoc syntaxes.
    Internally, Odoc replaces Octavius as the documentation parser.

#### Bug fixes

  + Fix unstabilizing comments on assignments (ocaml-ppx/ocamlformat#1093) (Guillaume Petiot)
  + Fix the default value documentation for `max-indent` (ocaml-ppx/ocamlformat#1105) (Guillaume Petiot)
  + Fix closing parenthesis exceeding the margin in function application (ocaml-ppx/ocamlformat#1098) (Jules Aguillon)
  + Missing break before attributes of `Pmty_with` (ocaml-ppx/ocamlformat#1103) (Josh Berdine)
  + Fix closing quote exceeding the margin (ocaml-ppx/ocamlformat#1096) (Jules Aguillon)
  + Fix break before the closing bracket of collections (exceeding the margin) (ocaml-ppx/ocamlformat#1073) (Guillaume Petiot)
  + Fix precedence of Dot wrt Hash (ocaml-ppx/ocamlformat#1058) (Guillaume Petiot)
  + Fix break in variant type definition to not exceed the margin (ocaml-ppx/ocamlformat#1064) (Guillaume Petiot)
  + Fix newlines and indentation in toplevel extension points (ocaml-ppx/ocamlformat#1054) (Guillaume Petiot)
  + Fix placement of doc comments around extensions (ocaml-ppx/ocamlformat#1052) (Jules Aguillon)
  + Inline extensions that do not break (ocaml-ppx/ocamlformat#1050) (Guillaume Petiot)
  + Add missing cut before attributes in type declarations (ocaml-ppx/ocamlformat#1051) (Guillaume Petiot)
  + Fix alignment of cases (ocaml-ppx/ocamlformat#1046) (Guillaume Petiot)
  + Fix blank line after comments at the end of lists (ocaml-ppx/ocamlformat#1045) (Guillaume Petiot)
  + Fix indexing operators precedence (ocaml-ppx/ocamlformat#1039) (Jules Aguillon)
  + Fix dropped comment after infix op (ocaml-ppx/ocamlformat#1030) (Guillaume Petiot)
  + No newline if the input is empty (ocaml-ppx/ocamlformat#1031) (Guillaume Petiot)
  + Fix unstable comments around attributes (ocaml-ppx/ocamlformat#1029) (Guillaume Petiot)
  + Fix extra blank line in sequence (ocaml-ppx/ocamlformat#1021) (Jules Aguillon)
  + Check functor arguments when computing placement of doc comments (ocaml-ppx/ocamlformat#1013) (Jules Aguillon)
  + Fix indentation of labelled args (ocaml-ppx/ocamlformat#1006) (Guillaume Petiot)
  + Fix linebreak between or-cases with comments when `break-cases=all` (ocaml-ppx/ocamlformat#1002) (Guillaume Petiot)
  + Fix unstable unattached doc comment in records (ocaml-ppx/ocamlformat#998) (Jules Aguillon)
  + Fix string literal changed (ocaml-ppx/ocamlformat#995) (Jules Aguillon)
  + Fix type variable (ocaml-ppx/ocamlformat#996) (Jules Aguillon)
  + Fix crash on extension sequence (ocaml-ppx/ocamlformat#992) (Guillaume Petiot)
  + Fix position of expressions regarding of comments in infix-op expressions (ocaml-ppx/ocamlformat#986) (Guillaume Petiot)
  + Escape special characters in external declaration (ocaml-ppx/ocamlformat#988) (Jules Aguillon)
  + Fix parens around constrained expr with attrs (ocaml-ppx/ocamlformat#987) (Guillaume Petiot)
  + Fix the margin, and correctly breaks comments (ocaml-ppx/ocamlformat#957) (Guillaume Petiot)
  + Fix formatting of custom indexing operators (ocaml-ppx/ocamlformat#975) (Guillaume Petiot)
  + Fix position of comments of labelled arrow types (ocaml-ppx/ocamlformat#976) (Guillaume Petiot)
  + No box around inline odoc styles (ocaml-ppx/ocamlformat#971) (Guillaume Petiot)
  + Fix boxing of collection expressions/patterns (ocaml-ppx/ocamlformat#960) (Guillaume Petiot)
  + Fix crash on record expr with pack fields (ocaml-ppx/ocamlformat#963) (Jules Aguillon)
  + Fix letop in subexpr (ocaml-ppx/ocamlformat#956) (hhugo)

#### Internal

  + Take file kind from --name when formatting stdin (ocaml-ppx/ocamlformat#1119) (Jules Aguillon)
  + Make Fmt.t abstract (ocaml-ppx/ocamlformat#1109) (Jules Aguillon)
  + Future-proof Fmt API in case Fmt.t goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Future-proof `Fmt` API in case `Fmt.t` goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Optional names for formatting boxes in debug output (ocaml-ppx/ocamlformat#1083) (Guillaume Petiot)
  + Check ocamlformat error codes in the testsuite (ocaml-ppx/ocamlformat#1084) (Etienne Millon)
  + Clean `Translation_unit` (ocaml-ppx/ocamlformat#1078) (Guillaume Petiot)
  + Use dune file generation in test/passing/dune (ocaml-ppx/ocamlformat#1082) (Etienne Millon)
  + CI: factorize tests and check reason build (ocaml-ppx/ocamlformat#1079) (Guillaume Petiot)
  + Use short form for action in src/dune (ocaml-ppx/ocamlformat#1076) (Etienne Millon)
  + Cleanup `sequence_blank_line` (ocaml-ppx/ocamlformat#1075) (Jules Aguillon)
  + CI: use a script travis-ci.sh to simplify .travis.yml (ocaml-ppx/ocamlformat#1063) (Guillaume Petiot)
  + Remove utility functions from `Fmt_ast` (ocaml-ppx/ocamlformat#1059) (Guillaume Petiot)
  + CI: use opam-2.0.5 in Travis (ocaml-ppx/ocamlformat#1044) (Anton Kochkov)
  + CI: check the build with OCaml 4.07.1 and 4.08.0 (ocaml-ppx/ocamlformat#1036) (Jules Aguillon)
  + Use the same sets of options for both branches by default in `test_branch.sh` (ocaml-ppx/ocamlformat#1033) (Guillaume Petiot)
  + Fix `test_branch.sh` and CI checking of CHANGES.md (ocaml-ppx/ocamlformat#1032, ocaml-ppx/ocamlformat#1034) (Jules Aguillon)
  + Fix flag of git-worktree in `test_branch.sh` and `bisect.sh` (ocaml-ppx/ocamlformat#1027) (Guillaume Petiot)
  + Remove the `bisect_ppx` dependency and clean the `Makefile` (ocaml-ppx/ocamlformat#1005) (Jules Aguillon)
  + Use a `CHANGES.md` log file again (ocaml-ppx/ocamlformat#1023) (Guillaume Petiot)
  + Support OCaml 4.09.0 (add the odoc.1.4.2 dependency) (ocaml-ppx/ocamlformat#1024) (Guillaume Petiot)
  + Update labels of issue templates (ocaml-ppx/ocamlformat#1017) (Guillaume Petiot)
  + Update labels in `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#1007) (Guillaume Petiot)
  + Allow to ignore invalid options (ocaml-ppx/ocamlformat#984) (hhugo)
    The `--ignore-invalid-option` flag is added to ignore invalid options in `.ocamlformat` files.
  + Improve the documentation of `--doc-comments` (ocaml-ppx/ocamlformat#982) (Jules Aguillon)
  + Remove symbolic links and change naming convention of tests (ocaml-ppx/ocamlformat#980) (Guillaume Petiot)
  + Change the type of `fmt_code` (ocaml-ppx/ocamlformat#974) (Guillaume Petiot)
  + Simplify `Makefile` (ocaml-ppx/ocamlformat#973) (hhugo)
  + Dune should not be flagged as a build dep anymore (ocaml-ppx/ocamlformat#954) (Guillaume Petiot)
Julow added a commit to Julow/opam-repository that referenced this pull request Nov 4, 2019
CHANGES:

#### Changes

  + Set "conventional" as the default profile (ocaml-ppx/ocamlformat#1060) (Guillaume Petiot)
    This new profile is made to better match the most used style and is encouraged.
    To continue using the previous default, use `profile = ocamlformat` in your `.ocamlformat`.
  + CLI: Allow both values of boolean options (ocaml-ppx/ocamlformat#1062) (Jules Aguillon)
    Now, both `--opt` and --no-opt` are available on the CLI for any boolean option "opt".
    Previously, only one of them were available depending on the default value.
  + Auto mode for `break-string-literals` (ocaml-ppx/ocamlformat#1057) (Guillaume Petiot)
    `wrap`, `newlines` and `newlines-and-wrap` values of `break-string-literals` are removed.
    `auto` replaces them, it is equivalent to `newlines-and-wrap`.
  + Dock collection brackets (ocaml-ppx/ocamlformat#1014) (Guillaume Petiot)
    `after-and-docked` value of `break-separators` is removed and is replaced by a new `dock-collection-brackets` option.
  + Preserve `begin` and `end` keywords in if-then-else (ocaml-ppx/ocamlformat#978) (Jules Aguillon)
    Previously, `begin`/`end` keywords around if-then-else branches were turned into parentheses.

#### New features

  + Give a hint when warning 50 is raised (ocaml-ppx/ocamlformat#1111) (Guillaume Petiot)
  + Add a message when a config value is removed (ocaml-ppx/ocamlformat#1089) (Etienne Millon)
    Explain what replaces removed options and avoid printing a parsing error.
  + Implement `sequence-blank-line=preserve-one` for let bindings (ocaml-ppx/ocamlformat#1077) (Jules Aguillon)
    Preserve a blank line after `let .. in` when `sequence-blank-line` set to `preserve-one`.
    Previously, only blank lines after `;` could be preserved.
  + Parse toplevel directives (ocaml-ppx/ocamlformat#1020) (Jules Aguillon)
    Allow `#directives` in `.ml` files.
    Previously, files containing a directive needed to be parsed as "use file".
    The "use file" mode is removed and `--use-file` is now the same as `--impl`.
  + Don't require `--name`, require kind, forbid `--inplace`, allow `--check`, make `--enable-outside-detected-project` implicit when reading from stdin (ocaml-ppx/ocamlformat#1018) (Guillaume Petiot)
  + Parse code in docstrings (ocaml-ppx/ocamlformat#941) (Guillaume Petiot)
    Format OCaml code in cinaps-style comments `(*$ code *)` and code blocks in documentation comments `(** {[ code ]} *)`.
  + Parse documentation comments with Odoc (ocaml-ppx/ocamlformat#721) (Jules Aguillon)
    Formatting of documentation comments is more robust and support newer Odoc syntaxes.
    Internally, Odoc replaces Octavius as the documentation parser.

#### Bug fixes

  + Fix unstabilizing comments on assignments (ocaml-ppx/ocamlformat#1093) (Guillaume Petiot)
  + Fix the default value documentation for `max-indent` (ocaml-ppx/ocamlformat#1105) (Guillaume Petiot)
  + Fix closing parenthesis exceeding the margin in function application (ocaml-ppx/ocamlformat#1098) (Jules Aguillon)
  + Missing break before attributes of `Pmty_with` (ocaml-ppx/ocamlformat#1103) (Josh Berdine)
  + Fix closing quote exceeding the margin (ocaml-ppx/ocamlformat#1096) (Jules Aguillon)
  + Fix break before the closing bracket of collections (exceeding the margin) (ocaml-ppx/ocamlformat#1073) (Guillaume Petiot)
  + Fix precedence of Dot wrt Hash (ocaml-ppx/ocamlformat#1058) (Guillaume Petiot)
  + Fix break in variant type definition to not exceed the margin (ocaml-ppx/ocamlformat#1064) (Guillaume Petiot)
  + Fix newlines and indentation in toplevel extension points (ocaml-ppx/ocamlformat#1054) (Guillaume Petiot)
  + Fix placement of doc comments around extensions (ocaml-ppx/ocamlformat#1052) (Jules Aguillon)
  + Inline extensions that do not break (ocaml-ppx/ocamlformat#1050) (Guillaume Petiot)
  + Add missing cut before attributes in type declarations (ocaml-ppx/ocamlformat#1051) (Guillaume Petiot)
  + Fix alignment of cases (ocaml-ppx/ocamlformat#1046) (Guillaume Petiot)
  + Fix blank line after comments at the end of lists (ocaml-ppx/ocamlformat#1045) (Guillaume Petiot)
  + Fix indexing operators precedence (ocaml-ppx/ocamlformat#1039) (Jules Aguillon)
  + Fix dropped comment after infix op (ocaml-ppx/ocamlformat#1030) (Guillaume Petiot)
  + No newline if the input is empty (ocaml-ppx/ocamlformat#1031) (Guillaume Petiot)
  + Fix unstable comments around attributes (ocaml-ppx/ocamlformat#1029) (Guillaume Petiot)
  + Fix extra blank line in sequence (ocaml-ppx/ocamlformat#1021) (Jules Aguillon)
  + Check functor arguments when computing placement of doc comments (ocaml-ppx/ocamlformat#1013) (Jules Aguillon)
  + Fix indentation of labelled args (ocaml-ppx/ocamlformat#1006) (Guillaume Petiot)
  + Fix linebreak between or-cases with comments when `break-cases=all` (ocaml-ppx/ocamlformat#1002) (Guillaume Petiot)
  + Fix unstable unattached doc comment in records (ocaml-ppx/ocamlformat#998) (Jules Aguillon)
  + Fix string literal changed (ocaml-ppx/ocamlformat#995) (Jules Aguillon)
  + Fix type variable (ocaml-ppx/ocamlformat#996) (Jules Aguillon)
  + Fix crash on extension sequence (ocaml-ppx/ocamlformat#992) (Guillaume Petiot)
  + Fix position of expressions regarding of comments in infix-op expressions (ocaml-ppx/ocamlformat#986) (Guillaume Petiot)
  + Escape special characters in external declaration (ocaml-ppx/ocamlformat#988) (Jules Aguillon)
  + Fix parens around constrained expr with attrs (ocaml-ppx/ocamlformat#987) (Guillaume Petiot)
  + Fix the margin, and correctly breaks comments (ocaml-ppx/ocamlformat#957) (Guillaume Petiot)
  + Fix formatting of custom indexing operators (ocaml-ppx/ocamlformat#975) (Guillaume Petiot)
  + Fix position of comments of labelled arrow types (ocaml-ppx/ocamlformat#976) (Guillaume Petiot)
  + No box around inline odoc styles (ocaml-ppx/ocamlformat#971) (Guillaume Petiot)
  + Fix boxing of collection expressions/patterns (ocaml-ppx/ocamlformat#960) (Guillaume Petiot)
  + Fix crash on record expr with pack fields (ocaml-ppx/ocamlformat#963) (Jules Aguillon)
  + Fix letop in subexpr (ocaml-ppx/ocamlformat#956) (hhugo)

#### Internal

  + Take file kind from --name when formatting stdin (ocaml-ppx/ocamlformat#1119) (Jules Aguillon)
  + Make Fmt.t abstract (ocaml-ppx/ocamlformat#1109) (Jules Aguillon)
  + Future-proof Fmt API in case Fmt.t goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Future-proof `Fmt` API in case `Fmt.t` goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Optional names for formatting boxes in debug output (ocaml-ppx/ocamlformat#1083) (Guillaume Petiot)
  + Check ocamlformat error codes in the testsuite (ocaml-ppx/ocamlformat#1084) (Etienne Millon)
  + Clean `Translation_unit` (ocaml-ppx/ocamlformat#1078) (Guillaume Petiot)
  + Use dune file generation in test/passing/dune (ocaml-ppx/ocamlformat#1082) (Etienne Millon)
  + CI: factorize tests and check reason build (ocaml-ppx/ocamlformat#1079) (Guillaume Petiot)
  + Use short form for action in src/dune (ocaml-ppx/ocamlformat#1076) (Etienne Millon)
  + Cleanup `sequence_blank_line` (ocaml-ppx/ocamlformat#1075) (Jules Aguillon)
  + CI: use a script travis-ci.sh to simplify .travis.yml (ocaml-ppx/ocamlformat#1063) (Guillaume Petiot)
  + Remove utility functions from `Fmt_ast` (ocaml-ppx/ocamlformat#1059) (Guillaume Petiot)
  + CI: use opam-2.0.5 in Travis (ocaml-ppx/ocamlformat#1044) (Anton Kochkov)
  + CI: check the build with OCaml 4.07.1 and 4.08.0 (ocaml-ppx/ocamlformat#1036) (Jules Aguillon)
  + Use the same sets of options for both branches by default in `test_branch.sh` (ocaml-ppx/ocamlformat#1033) (Guillaume Petiot)
  + Fix `test_branch.sh` and CI checking of CHANGES.md (ocaml-ppx/ocamlformat#1032, ocaml-ppx/ocamlformat#1034) (Jules Aguillon)
  + Fix flag of git-worktree in `test_branch.sh` and `bisect.sh` (ocaml-ppx/ocamlformat#1027) (Guillaume Petiot)
  + Remove the `bisect_ppx` dependency and clean the `Makefile` (ocaml-ppx/ocamlformat#1005) (Jules Aguillon)
  + Use a `CHANGES.md` log file again (ocaml-ppx/ocamlformat#1023) (Guillaume Petiot)
  + Support OCaml 4.09.0 (add the odoc.1.4.2 dependency) (ocaml-ppx/ocamlformat#1024) (Guillaume Petiot)
  + Update labels of issue templates (ocaml-ppx/ocamlformat#1017) (Guillaume Petiot)
  + Update labels in `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#1007) (Guillaume Petiot)
  + Allow to ignore invalid options (ocaml-ppx/ocamlformat#984) (hhugo)
    The `--ignore-invalid-option` flag is added to ignore invalid options in `.ocamlformat` files.
  + Improve the documentation of `--doc-comments` (ocaml-ppx/ocamlformat#982) (Jules Aguillon)
  + Remove symbolic links and change naming convention of tests (ocaml-ppx/ocamlformat#980) (Guillaume Petiot)
  + Change the type of `fmt_code` (ocaml-ppx/ocamlformat#974) (Guillaume Petiot)
  + Simplify `Makefile` (ocaml-ppx/ocamlformat#973) (hhugo)
  + Dune should not be flagged as a build dep anymore (ocaml-ppx/ocamlformat#954) (Guillaume Petiot)
Julow added a commit to Julow/opam-repository that referenced this pull request Nov 4, 2019
CHANGES:

#### Changes

  + Set "conventional" as the default profile (ocaml-ppx/ocamlformat#1060) (Guillaume Petiot)
    This new profile is made to better match the most used style and is encouraged.
    To continue using the previous default, use `profile = ocamlformat` in your `.ocamlformat`.
  + CLI: Allow both values of boolean options (ocaml-ppx/ocamlformat#1062) (Jules Aguillon)
    Now, both `--opt` and --no-opt` are available on the CLI for any boolean option "opt".
    Previously, only one of them were available depending on the default value.
  + Auto mode for `break-string-literals` (ocaml-ppx/ocamlformat#1057) (Guillaume Petiot)
    `wrap`, `newlines` and `newlines-and-wrap` values of `break-string-literals` are removed.
    `auto` replaces them, it is equivalent to `newlines-and-wrap`.
  + Dock collection brackets (ocaml-ppx/ocamlformat#1014) (Guillaume Petiot)
    `after-and-docked` value of `break-separators` is removed and is replaced by a new `dock-collection-brackets` option.
  + Preserve `begin` and `end` keywords in if-then-else (ocaml-ppx/ocamlformat#978) (Jules Aguillon)
    Previously, `begin`/`end` keywords around if-then-else branches were turned into parentheses.

#### New features

  + Give a hint when warning 50 is raised (ocaml-ppx/ocamlformat#1111) (Guillaume Petiot)
  + Add a message when a config value is removed (ocaml-ppx/ocamlformat#1089) (Etienne Millon)
    Explain what replaces removed options and avoid printing a parsing error.
  + Implement `sequence-blank-line=preserve-one` for let bindings (ocaml-ppx/ocamlformat#1077) (Jules Aguillon)
    Preserve a blank line after `let .. in` when `sequence-blank-line` set to `preserve-one`.
    Previously, only blank lines after `;` could be preserved.
  + Parse toplevel directives (ocaml-ppx/ocamlformat#1020) (Jules Aguillon)
    Allow `#directives` in `.ml` files.
    Previously, files containing a directive needed to be parsed as "use file".
    The "use file" mode is removed and `--use-file` is now the same as `--impl`.
  + Don't require `--name`, require kind, forbid `--inplace`, allow `--check`, make `--enable-outside-detected-project` implicit when reading from stdin (ocaml-ppx/ocamlformat#1018) (Guillaume Petiot)
  + Parse code in docstrings (ocaml-ppx/ocamlformat#941) (Guillaume Petiot)
    Format OCaml code in cinaps-style comments `(*$ code *)` and code blocks in documentation comments `(** {[ code ]} *)`.
  + Parse documentation comments with Odoc (ocaml-ppx/ocamlformat#721) (Jules Aguillon)
    Formatting of documentation comments is more robust and support newer Odoc syntaxes.
    Internally, Odoc replaces Octavius as the documentation parser.

#### Bug fixes

  + Fix unstabilizing comments on assignments (ocaml-ppx/ocamlformat#1093) (Guillaume Petiot)
  + Fix the default value documentation for `max-indent` (ocaml-ppx/ocamlformat#1105) (Guillaume Petiot)
  + Fix closing parenthesis exceeding the margin in function application (ocaml-ppx/ocamlformat#1098) (Jules Aguillon)
  + Missing break before attributes of `Pmty_with` (ocaml-ppx/ocamlformat#1103) (Josh Berdine)
  + Fix closing quote exceeding the margin (ocaml-ppx/ocamlformat#1096) (Jules Aguillon)
  + Fix break before the closing bracket of collections (exceeding the margin) (ocaml-ppx/ocamlformat#1073) (Guillaume Petiot)
  + Fix precedence of Dot wrt Hash (ocaml-ppx/ocamlformat#1058) (Guillaume Petiot)
  + Fix break in variant type definition to not exceed the margin (ocaml-ppx/ocamlformat#1064) (Guillaume Petiot)
  + Fix newlines and indentation in toplevel extension points (ocaml-ppx/ocamlformat#1054) (Guillaume Petiot)
  + Fix placement of doc comments around extensions (ocaml-ppx/ocamlformat#1052) (Jules Aguillon)
  + Inline extensions that do not break (ocaml-ppx/ocamlformat#1050) (Guillaume Petiot)
  + Add missing cut before attributes in type declarations (ocaml-ppx/ocamlformat#1051) (Guillaume Petiot)
  + Fix alignment of cases (ocaml-ppx/ocamlformat#1046) (Guillaume Petiot)
  + Fix blank line after comments at the end of lists (ocaml-ppx/ocamlformat#1045) (Guillaume Petiot)
  + Fix indexing operators precedence (ocaml-ppx/ocamlformat#1039) (Jules Aguillon)
  + Fix dropped comment after infix op (ocaml-ppx/ocamlformat#1030) (Guillaume Petiot)
  + No newline if the input is empty (ocaml-ppx/ocamlformat#1031) (Guillaume Petiot)
  + Fix unstable comments around attributes (ocaml-ppx/ocamlformat#1029) (Guillaume Petiot)
  + Fix extra blank line in sequence (ocaml-ppx/ocamlformat#1021) (Jules Aguillon)
  + Check functor arguments when computing placement of doc comments (ocaml-ppx/ocamlformat#1013) (Jules Aguillon)
  + Fix indentation of labelled args (ocaml-ppx/ocamlformat#1006) (Guillaume Petiot)
  + Fix linebreak between or-cases with comments when `break-cases=all` (ocaml-ppx/ocamlformat#1002) (Guillaume Petiot)
  + Fix unstable unattached doc comment in records (ocaml-ppx/ocamlformat#998) (Jules Aguillon)
  + Fix string literal changed (ocaml-ppx/ocamlformat#995) (Jules Aguillon)
  + Fix type variable (ocaml-ppx/ocamlformat#996) (Jules Aguillon)
  + Fix crash on extension sequence (ocaml-ppx/ocamlformat#992) (Guillaume Petiot)
  + Fix position of expressions regarding of comments in infix-op expressions (ocaml-ppx/ocamlformat#986) (Guillaume Petiot)
  + Escape special characters in external declaration (ocaml-ppx/ocamlformat#988) (Jules Aguillon)
  + Fix parens around constrained expr with attrs (ocaml-ppx/ocamlformat#987) (Guillaume Petiot)
  + Fix the margin, and correctly breaks comments (ocaml-ppx/ocamlformat#957) (Guillaume Petiot)
  + Fix formatting of custom indexing operators (ocaml-ppx/ocamlformat#975) (Guillaume Petiot)
  + Fix position of comments of labelled arrow types (ocaml-ppx/ocamlformat#976) (Guillaume Petiot)
  + No box around inline odoc styles (ocaml-ppx/ocamlformat#971) (Guillaume Petiot)
  + Fix boxing of collection expressions/patterns (ocaml-ppx/ocamlformat#960) (Guillaume Petiot)
  + Fix crash on record expr with pack fields (ocaml-ppx/ocamlformat#963) (Jules Aguillon)
  + Fix letop in subexpr (ocaml-ppx/ocamlformat#956) (hhugo)

#### Internal

  + Take file kind from --name when formatting stdin (ocaml-ppx/ocamlformat#1119) (Jules Aguillon)
  + Make Fmt.t abstract (ocaml-ppx/ocamlformat#1109) (Jules Aguillon)
  + Future-proof Fmt API in case Fmt.t goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Future-proof `Fmt` API in case `Fmt.t` goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Optional names for formatting boxes in debug output (ocaml-ppx/ocamlformat#1083) (Guillaume Petiot)
  + Check ocamlformat error codes in the testsuite (ocaml-ppx/ocamlformat#1084) (Etienne Millon)
  + Clean `Translation_unit` (ocaml-ppx/ocamlformat#1078) (Guillaume Petiot)
  + Use dune file generation in test/passing/dune (ocaml-ppx/ocamlformat#1082) (Etienne Millon)
  + CI: factorize tests and check reason build (ocaml-ppx/ocamlformat#1079) (Guillaume Petiot)
  + Use short form for action in src/dune (ocaml-ppx/ocamlformat#1076) (Etienne Millon)
  + Cleanup `sequence_blank_line` (ocaml-ppx/ocamlformat#1075) (Jules Aguillon)
  + CI: use a script travis-ci.sh to simplify .travis.yml (ocaml-ppx/ocamlformat#1063) (Guillaume Petiot)
  + Remove utility functions from `Fmt_ast` (ocaml-ppx/ocamlformat#1059) (Guillaume Petiot)
  + CI: use opam-2.0.5 in Travis (ocaml-ppx/ocamlformat#1044) (Anton Kochkov)
  + CI: check the build with OCaml 4.07.1 and 4.08.0 (ocaml-ppx/ocamlformat#1036) (Jules Aguillon)
  + Use the same sets of options for both branches by default in `test_branch.sh` (ocaml-ppx/ocamlformat#1033) (Guillaume Petiot)
  + Fix `test_branch.sh` and CI checking of CHANGES.md (ocaml-ppx/ocamlformat#1032, ocaml-ppx/ocamlformat#1034) (Jules Aguillon)
  + Fix flag of git-worktree in `test_branch.sh` and `bisect.sh` (ocaml-ppx/ocamlformat#1027) (Guillaume Petiot)
  + Remove the `bisect_ppx` dependency and clean the `Makefile` (ocaml-ppx/ocamlformat#1005) (Jules Aguillon)
  + Use a `CHANGES.md` log file again (ocaml-ppx/ocamlformat#1023) (Guillaume Petiot)
  + Support OCaml 4.09.0 (add the odoc.1.4.2 dependency) (ocaml-ppx/ocamlformat#1024) (Guillaume Petiot)
  + Update labels of issue templates (ocaml-ppx/ocamlformat#1017) (Guillaume Petiot)
  + Update labels in `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#1007) (Guillaume Petiot)
  + Allow to ignore invalid options (ocaml-ppx/ocamlformat#984) (hhugo)
    The `--ignore-invalid-option` flag is added to ignore invalid options in `.ocamlformat` files.
  + Improve the documentation of `--doc-comments` (ocaml-ppx/ocamlformat#982) (Jules Aguillon)
  + Remove symbolic links and change naming convention of tests (ocaml-ppx/ocamlformat#980) (Guillaume Petiot)
  + Change the type of `fmt_code` (ocaml-ppx/ocamlformat#974) (Guillaume Petiot)
  + Simplify `Makefile` (ocaml-ppx/ocamlformat#973) (hhugo)
  + Dune should not be flagged as a build dep anymore (ocaml-ppx/ocamlformat#954) (Guillaume Petiot)
Julow added a commit to Julow/opam-repository that referenced this pull request Nov 4, 2019
CHANGES:

#### Changes

  + Set "conventional" as the default profile (ocaml-ppx/ocamlformat#1060) (Guillaume Petiot)
    This new profile is made to better match the most used style and is encouraged.
    To continue using the previous default, use `profile = ocamlformat` in your `.ocamlformat`.
  + CLI: Allow both values of boolean options (ocaml-ppx/ocamlformat#1062) (Jules Aguillon)
    Now, both `--opt` and --no-opt` are available on the CLI for any boolean option "opt".
    Previously, only one of them were available depending on the default value.
  + Auto mode for `break-string-literals` (ocaml-ppx/ocamlformat#1057) (Guillaume Petiot)
    `wrap`, `newlines` and `newlines-and-wrap` values of `break-string-literals` are removed.
    `auto` replaces them, it is equivalent to `newlines-and-wrap`.
  + Dock collection brackets (ocaml-ppx/ocamlformat#1014) (Guillaume Petiot)
    `after-and-docked` value of `break-separators` is removed and is replaced by a new `dock-collection-brackets` option.
  + Preserve `begin` and `end` keywords in if-then-else (ocaml-ppx/ocamlformat#978) (Jules Aguillon)
    Previously, `begin`/`end` keywords around if-then-else branches were turned into parentheses.

#### New features

  + Give a hint when warning 50 is raised (ocaml-ppx/ocamlformat#1111) (Guillaume Petiot)
  + Add a message when a config value is removed (ocaml-ppx/ocamlformat#1089) (Etienne Millon)
    Explain what replaces removed options and avoid printing a parsing error.
  + Implement `sequence-blank-line=preserve-one` for let bindings (ocaml-ppx/ocamlformat#1077) (Jules Aguillon)
    Preserve a blank line after `let .. in` when `sequence-blank-line` set to `preserve-one`.
    Previously, only blank lines after `;` could be preserved.
  + Parse toplevel directives (ocaml-ppx/ocamlformat#1020) (Jules Aguillon)
    Allow `#directives` in `.ml` files.
    Previously, files containing a directive needed to be parsed as "use file".
    The "use file" mode is removed and `--use-file` is now the same as `--impl`.
  + Don't require `--name`, require kind, forbid `--inplace`, allow `--check`, make `--enable-outside-detected-project` implicit when reading from stdin (ocaml-ppx/ocamlformat#1018) (Guillaume Petiot)
  + Parse code in docstrings (ocaml-ppx/ocamlformat#941) (Guillaume Petiot)
    Format OCaml code in cinaps-style comments `(*$ code *)` and code blocks in documentation comments `(** {[ code ]} *)`.
  + Parse documentation comments with Odoc (ocaml-ppx/ocamlformat#721) (Jules Aguillon)
    Formatting of documentation comments is more robust and support newer Odoc syntaxes.
    Internally, Odoc replaces Octavius as the documentation parser.

#### Bug fixes

  + Fix unstabilizing comments on assignments (ocaml-ppx/ocamlformat#1093) (Guillaume Petiot)
  + Fix the default value documentation for `max-indent` (ocaml-ppx/ocamlformat#1105) (Guillaume Petiot)
  + Fix closing parenthesis exceeding the margin in function application (ocaml-ppx/ocamlformat#1098) (Jules Aguillon)
  + Missing break before attributes of `Pmty_with` (ocaml-ppx/ocamlformat#1103) (Josh Berdine)
  + Fix closing quote exceeding the margin (ocaml-ppx/ocamlformat#1096) (Jules Aguillon)
  + Fix break before the closing bracket of collections (exceeding the margin) (ocaml-ppx/ocamlformat#1073) (Guillaume Petiot)
  + Fix precedence of Dot wrt Hash (ocaml-ppx/ocamlformat#1058) (Guillaume Petiot)
  + Fix break in variant type definition to not exceed the margin (ocaml-ppx/ocamlformat#1064) (Guillaume Petiot)
  + Fix newlines and indentation in toplevel extension points (ocaml-ppx/ocamlformat#1054) (Guillaume Petiot)
  + Fix placement of doc comments around extensions (ocaml-ppx/ocamlformat#1052) (Jules Aguillon)
  + Inline extensions that do not break (ocaml-ppx/ocamlformat#1050) (Guillaume Petiot)
  + Add missing cut before attributes in type declarations (ocaml-ppx/ocamlformat#1051) (Guillaume Petiot)
  + Fix alignment of cases (ocaml-ppx/ocamlformat#1046) (Guillaume Petiot)
  + Fix blank line after comments at the end of lists (ocaml-ppx/ocamlformat#1045) (Guillaume Petiot)
  + Fix indexing operators precedence (ocaml-ppx/ocamlformat#1039) (Jules Aguillon)
  + Fix dropped comment after infix op (ocaml-ppx/ocamlformat#1030) (Guillaume Petiot)
  + No newline if the input is empty (ocaml-ppx/ocamlformat#1031) (Guillaume Petiot)
  + Fix unstable comments around attributes (ocaml-ppx/ocamlformat#1029) (Guillaume Petiot)
  + Fix extra blank line in sequence (ocaml-ppx/ocamlformat#1021) (Jules Aguillon)
  + Check functor arguments when computing placement of doc comments (ocaml-ppx/ocamlformat#1013) (Jules Aguillon)
  + Fix indentation of labelled args (ocaml-ppx/ocamlformat#1006) (Guillaume Petiot)
  + Fix linebreak between or-cases with comments when `break-cases=all` (ocaml-ppx/ocamlformat#1002) (Guillaume Petiot)
  + Fix unstable unattached doc comment in records (ocaml-ppx/ocamlformat#998) (Jules Aguillon)
  + Fix string literal changed (ocaml-ppx/ocamlformat#995) (Jules Aguillon)
  + Fix type variable (ocaml-ppx/ocamlformat#996) (Jules Aguillon)
  + Fix crash on extension sequence (ocaml-ppx/ocamlformat#992) (Guillaume Petiot)
  + Fix position of expressions regarding of comments in infix-op expressions (ocaml-ppx/ocamlformat#986) (Guillaume Petiot)
  + Escape special characters in external declaration (ocaml-ppx/ocamlformat#988) (Jules Aguillon)
  + Fix parens around constrained expr with attrs (ocaml-ppx/ocamlformat#987) (Guillaume Petiot)
  + Fix the margin, and correctly breaks comments (ocaml-ppx/ocamlformat#957) (Guillaume Petiot)
  + Fix formatting of custom indexing operators (ocaml-ppx/ocamlformat#975) (Guillaume Petiot)
  + Fix position of comments of labelled arrow types (ocaml-ppx/ocamlformat#976) (Guillaume Petiot)
  + No box around inline odoc styles (ocaml-ppx/ocamlformat#971) (Guillaume Petiot)
  + Fix boxing of collection expressions/patterns (ocaml-ppx/ocamlformat#960) (Guillaume Petiot)
  + Fix crash on record expr with pack fields (ocaml-ppx/ocamlformat#963) (Jules Aguillon)
  + Fix letop in subexpr (ocaml-ppx/ocamlformat#956) (hhugo)

#### Internal

  + Take file kind from --name when formatting stdin (ocaml-ppx/ocamlformat#1119) (Jules Aguillon)
  + Make Fmt.t abstract (ocaml-ppx/ocamlformat#1109) (Jules Aguillon)
  + Future-proof Fmt API in case Fmt.t goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Future-proof `Fmt` API in case `Fmt.t` goes abstract (ocaml-ppx/ocamlformat#1106) (Etienne Millon)
  + Optional names for formatting boxes in debug output (ocaml-ppx/ocamlformat#1083) (Guillaume Petiot)
  + Check ocamlformat error codes in the testsuite (ocaml-ppx/ocamlformat#1084) (Etienne Millon)
  + Clean `Translation_unit` (ocaml-ppx/ocamlformat#1078) (Guillaume Petiot)
  + Use dune file generation in test/passing/dune (ocaml-ppx/ocamlformat#1082) (Etienne Millon)
  + CI: factorize tests and check reason build (ocaml-ppx/ocamlformat#1079) (Guillaume Petiot)
  + Use short form for action in src/dune (ocaml-ppx/ocamlformat#1076) (Etienne Millon)
  + Cleanup `sequence_blank_line` (ocaml-ppx/ocamlformat#1075) (Jules Aguillon)
  + CI: use a script travis-ci.sh to simplify .travis.yml (ocaml-ppx/ocamlformat#1063) (Guillaume Petiot)
  + Remove utility functions from `Fmt_ast` (ocaml-ppx/ocamlformat#1059) (Guillaume Petiot)
  + CI: use opam-2.0.5 in Travis (ocaml-ppx/ocamlformat#1044) (Anton Kochkov)
  + CI: check the build with OCaml 4.07.1 and 4.08.0 (ocaml-ppx/ocamlformat#1036) (Jules Aguillon)
  + Use the same sets of options for both branches by default in `test_branch.sh` (ocaml-ppx/ocamlformat#1033) (Guillaume Petiot)
  + Fix `test_branch.sh` and CI checking of CHANGES.md (ocaml-ppx/ocamlformat#1032, ocaml-ppx/ocamlformat#1034) (Jules Aguillon)
  + Fix flag of git-worktree in `test_branch.sh` and `bisect.sh` (ocaml-ppx/ocamlformat#1027) (Guillaume Petiot)
  + Remove the `bisect_ppx` dependency and clean the `Makefile` (ocaml-ppx/ocamlformat#1005) (Jules Aguillon)
  + Use a `CHANGES.md` log file again (ocaml-ppx/ocamlformat#1023) (Guillaume Petiot)
  + Support OCaml 4.09.0 (add the odoc.1.4.2 dependency) (ocaml-ppx/ocamlformat#1024) (Guillaume Petiot)
  + Update labels of issue templates (ocaml-ppx/ocamlformat#1017) (Guillaume Petiot)
  + Update labels in `CONTRIBUTING.md` (ocaml-ppx/ocamlformat#1007) (Guillaume Petiot)
  + Allow to ignore invalid options (ocaml-ppx/ocamlformat#984) (hhugo)
    The `--ignore-invalid-option` flag is added to ignore invalid options in `.ocamlformat` files.
  + Improve the documentation of `--doc-comments` (ocaml-ppx/ocamlformat#982) (Jules Aguillon)
  + Remove symbolic links and change naming convention of tests (ocaml-ppx/ocamlformat#980) (Guillaume Petiot)
  + Change the type of `fmt_code` (ocaml-ppx/ocamlformat#974) (Guillaume Petiot)
  + Simplify `Makefile` (ocaml-ppx/ocamlformat#973) (hhugo)
  + Dune should not be flagged as a build dep anymore (ocaml-ppx/ocamlformat#954) (Guillaume Petiot)
bogdan2412 pushed a commit to bogdan2412/ocamlformat that referenced this pull request Mar 28, 2020
…ions (ocaml-ppx#986)

* externalize parenze_nested_exp
* externalize fmt_op_args
* break comments in infix sequences
* fix comments before op
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.

3 participants