1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 11:15:13 +03:00
aports/testing/ocaml-bisect_ppx/ppxlib-0.26-compat.patch

51 lines
1.8 KiB
Diff

Taken from https://github.com/aantron/bisect_ppx/pull/400
--- a/src/ppx/instrument.ml
+++ b/src/ppx/instrument.ml
@@ -490,11 +490,14 @@
|> List.map (fun (location_trace, p'') ->
(location_trace, Pat.alias ~loc ~attrs p'' x))
- | Ppat_construct (c, Some p') ->
+ | Ppat_construct (c, Some ([], p')) ->
recur ~enclosing_loc p'
|> List.map (fun (location_trace, p'') ->
(location_trace, Pat.construct ~loc ~attrs c (Some p'')))
+ | Ppat_construct (_, Some (_ :: _, _)) ->
+ Location.raise_errorf ~loc "bisect_ppx: named existentials aren't supported"
+
| Ppat_variant (c, Some p') ->
recur ~enclosing_loc p'
|> List.map (fun (location_trace, p'') ->
@@ -708,11 +711,14 @@
List.map (fun (_, p') -> bound_variables p') fields
|> List.flatten
- | Ppat_construct (_, Some p') | Ppat_variant (_, Some p')
+ | Ppat_construct (_, Some ([], p')) | Ppat_variant (_, Some p')
| Ppat_constraint (p', _) | Ppat_lazy p' | Ppat_exception p'
| Ppat_open (_, p') ->
bound_variables p'
+ | Ppat_construct (_, Some ({loc; _} :: _, _)) ->
+ Location.raise_errorf ~loc "bisect_ppx: named existentials aren't supported"
+
| Ppat_or (p_1, _) ->
bound_variables p_1 (* Should be unreachable. *)
@@ -725,10 +731,13 @@
| Ppat_type _ | Ppat_variant _ ->
true
- | Ppat_alias (p', _) | Ppat_construct (_, Some p')
+ | Ppat_alias (p', _) | Ppat_construct (_, Some ([], p'))
| Ppat_constraint (p', _) | Ppat_lazy p' | Ppat_exception p'
| Ppat_open (_, p') ->
has_polymorphic_variant p'
+
+ | Ppat_construct (_, Some ({loc; _} :: _, _)) ->
+ Location.raise_errorf ~loc "bisect_ppx: named existentials aren't supported"
| Ppat_tuple ps | Ppat_array ps ->
List.exists has_polymorphic_variant ps