From 2f58e876424e955de6b29a123980e43245cc8619 Mon Sep 17 00:00:00 2001 From: Daniel Mercier Date: Mon, 20 Dec 2021 11:09:03 +0100 Subject: [PATCH] Fix ppx_deriving_fold for polymorphic variants --- src_plugins/fold/ppx_deriving_fold.cppo.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_plugins/fold/ppx_deriving_fold.cppo.ml b/src_plugins/fold/ppx_deriving_fold.cppo.ml index 65be6947..f4311364 100644 --- a/src_plugins/fold/ppx_deriving_fold.cppo.ml +++ b/src_plugins/fold/ppx_deriving_fold.cppo.ml @@ -77,7 +77,7 @@ let rec expr_of_typ typ = raise_errorf ~loc:ptyp_loc "%s cannot be derived for %s" deriver (Ppx_deriving.string_of_core_type typ)) in - Exp.function_ cases + [%expr fun acc -> [%e Exp.function_ cases]] | { ptyp_desc = Ptyp_var name } -> evar ("poly_"^name) | { ptyp_desc = Ptyp_alias (typ, name) } -> [%expr fun acc x -> [%e evar ("poly_"^name)] ([%e expr_of_typ typ] acc x) x]