Blame ocaml-bisect-ppx-ppxlib-0.28.0.patch

9820f31
--- a/src/ppx/instrument.ml	2022-10-31 16:01:28.486756629 -0600
9820f31
+++ b/src/ppx/instrument.ml	2022-10-31 17:05:13.572237694 -0600
9820f31
@@ -1039,24 +1039,24 @@ class instrumenter =
9820f31
   let instrument_cases = Generated_code.instrument_cases points in
9820f31
 
9820f31
   object (self)
9820f31
-    inherit Ppxlib.Ast_traverse.map_with_expansion_context as super
9820f31
+    inherit Ppxlib.Ast_traverse.map_with_expansion_context_and_errors as super
9820f31
 
9820f31
     method! class_expr ctxt ce =
9820f31
       let loc = ce.pcl_loc in
9820f31
       let attrs = ce.pcl_attributes in
9820f31
-      let ce = super#class_expr ctxt ce in
9820f31
+      let ce, locs = super#class_expr ctxt ce in
9820f31
 
9820f31
       match ce.pcl_desc with
9820f31
       | Pcl_fun (l, e, p, ce) ->
9820f31
-        Cl.fun_ ~loc ~attrs l (Option.map instrument_expr e) p ce
9820f31
+        Cl.fun_ ~loc ~attrs l (Option.map instrument_expr e) p ce, locs
9820f31
 
9820f31
       | _ ->
9820f31
-        ce
9820f31
+        ce, locs
9820f31
 
9820f31
     method! class_field ctxt cf =
9820f31
       let loc = cf.pcf_loc in
9820f31
       let attrs = cf.pcf_attributes in
9820f31
-      let cf = super#class_field ctxt cf in
9820f31
+      let cf, locs = super#class_field ctxt cf in
9820f31
 
9820f31
       match cf.pcf_desc with
9820f31
       | Pcf_method (name, private_, cf) ->
9820f31
@@ -1065,13 +1065,13 @@ class instrumenter =
9820f31
           (match cf with
9820f31
           | Cfk_virtual _ -> cf
9820f31
           | Cfk_concrete (o, e) ->
9820f31
-            Cf.concrete o (instrument_expr e))
9820f31
+            Cf.concrete o (instrument_expr e)), locs
9820f31
 
9820f31
       | Pcf_initializer e ->
9820f31
-        Cf.initializer_ ~loc ~attrs (instrument_expr e)
9820f31
+        Cf.initializer_ ~loc ~attrs (instrument_expr e), locs
9820f31
 
9820f31
       | _ ->
9820f31
-        cf
9820f31
+        cf, locs
9820f31
 
9820f31
     method! expression ctxt e =
9820f31
       let is_trivial_function = Parsetree.(function
9820f31
@@ -1494,17 +1494,19 @@ class instrumenter =
9820f31
                 (f, traverse ~is_in_tail_position:false e)))
9820f31
 
9820f31
           | Pexp_letmodule (m, e, e') ->
9820f31
+            let mexpr', _locs = (self#module_expr ctxt e) in
9820f31
             Exp.letmodule ~loc ~attrs
9820f31
               m
9820f31
-              (self#module_expr ctxt e)
9820f31
+              mexpr'
9820f31
               (traverse ~is_in_tail_position e')
9820f31
 
9820f31
           | Pexp_letexception (c, e) ->
9820f31
             Exp.letexception ~loc ~attrs c (traverse ~is_in_tail_position e)
9820f31
 
9820f31
           | Pexp_open (m, e) ->
9820f31
+            let oexpr', _locs =  (self#open_declaration ctxt m) in
9820f31
             Exp.open_ ~loc ~attrs
9820f31
-              (self#open_declaration ctxt m)
9820f31
+              oexpr'
9820f31
               (traverse ~is_in_tail_position e)
9820f31
 
9820f31
           | Pexp_newtype (t, e) ->
9820f31
@@ -1513,10 +1515,12 @@ class instrumenter =
9820f31
           (* Expressions that don't need instrumentation, and where AST
9820f31
              traversal leaves the expression language. *)
9820f31
           | Pexp_object c ->
9820f31
-            Exp.object_ ~loc ~attrs (self#class_structure ctxt c)
9820f31
+            let cstr, _locs = (self#class_structure ctxt c) in
9820f31
+            Exp.object_ ~loc ~attrs cstr
9820f31
 
9820f31
           | Pexp_pack m ->
9820f31
-            Exp.pack ~loc ~attrs (self#module_expr ctxt m)
9820f31
+            let mexpr', _locs = (self#module_expr ctxt m) in
9820f31
+            Exp.pack ~loc ~attrs mexpr'
9820f31
 
9820f31
           (* Expressions that are not recursively traversed at all. *)
9820f31
           | Pexp_extension _ | Pexp_unreachable ->
9820f31
@@ -1536,7 +1540,7 @@ class instrumenter =
9820f31
 
9820f31
       in
9820f31
 
9820f31
-      traverse ~is_in_tail_position:false e
9820f31
+      traverse ~is_in_tail_position:false e, []
9820f31
 
9820f31
     (* Set to [true] upon encountering [[@@@coverage.off]], and back to
9820f31
        [false] again upon encountering [[@@@coverage.on]]. *)
9820f31
@@ -1548,7 +1552,7 @@ class instrumenter =
9820f31
       match si.pstr_desc with
9820f31
       | Pstr_value (rec_flag, bindings) ->
9820f31
         if structure_instrumentation_suppressed then
9820f31
-          si
9820f31
+          si, []
9820f31
 
9820f31
         else
9820f31
           let bindings =
9820f31
@@ -1580,16 +1584,18 @@ class instrumenter =
9820f31
               if do_not_instrument then
9820f31
                 binding
9820f31
               else
9820f31
-                {binding with pvb_expr = self#expression ctxt binding.pvb_expr}
9820f31
+                let expr', _errs = self#expression ctxt binding.pvb_expr in
9820f31
+                {binding with pvb_expr = expr'}
9820f31
             end
9820f31
           in
9820f31
-          Str.value ~loc rec_flag bindings
9820f31
+          Str.value ~loc rec_flag bindings, []
9820f31
 
9820f31
       | Pstr_eval (e, a) ->
9820f31
         if structure_instrumentation_suppressed then
9820f31
-          si
9820f31
+          si, []
9820f31
         else
9820f31
-          Str.eval ~loc ~attrs:a (self#expression ctxt e)
9820f31
+          let expr', errors = self#expression ctxt e in
9820f31
+          Str.eval ~loc ~attrs:a expr', errors
9820f31
 
9820f31
       | Pstr_attribute attribute ->
9820f31
         let kind = Coverage_attributes.recognize attribute in
9820f31
@@ -1612,17 +1618,17 @@ class instrumenter =
9820f31
           Location.raise_errorf
9820f31
             ~loc:attribute.attr_loc "coverage exclude_file is not allowed here."
9820f31
         end;
9820f31
-        si
9820f31
+        si, []
9820f31
 
9820f31
       | _ ->
9820f31
         super#structure_item ctxt si
9820f31
 
9820f31
     (* Don't instrument payloads of extensions and attributes. *)
9820f31
     method! extension _ e =
9820f31
-      e
9820f31
+      e, []
9820f31
 
9820f31
     method! attribute _ a =
9820f31
-      a
9820f31
+      a, []
9820f31
 
9820f31
     method! structure ctxt ast =
9820f31
       let saved_structure_instrumentation_suppressed =
9820f31
@@ -1655,7 +1661,7 @@ class instrumenter =
9820f31
           ast
9820f31
 
9820f31
         else begin
9820f31
-          let instrumented_ast = super#structure ctxt ast in
9820f31
+          let instrumented_ast, _errs = super#structure ctxt ast in
9820f31
           let runtime_initialization =
9820f31
             Generated_code.runtime_initialization points path in
9820f31
           runtime_initialization @ instrumented_ast
9820f31
--- a/src/ppx/instrument.mli	2022-03-14 01:39:55.000000000 -0600
9820f31
+++ b/src/ppx/instrument.mli	2022-10-31 15:48:11.733614835 -0600
9820f31
@@ -5,7 +5,7 @@
9820f31
 
9820f31
 
9820f31
 class instrumenter : object
9820f31
-   inherit Ppxlib.Ast_traverse.map_with_expansion_context
9820f31
+   inherit Ppxlib.Ast_traverse.map_with_expansion_context_and_errors
9820f31
 
9820f31
    method transform_impl_file:
9820f31
       Ppxlib.Expansion_context.Base.t ->