From fb529c4d2e0797031528250e73f4f83991f4e09e Mon Sep 17 00:00:00 2001 From: Ben Bellick Date: Mon, 16 Dec 2024 23:07:32 -0600 Subject: [PATCH] error for wildcard --- src/decoders_deriver.ml | 4 ++++ src/encoders_deriver.ml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/decoders_deriver.ml b/src/decoders_deriver.ml index f6adf86..76d4ccc 100644 --- a/src/decoders_deriver.ml +++ b/src/decoders_deriver.ml @@ -150,6 +150,10 @@ let rec expr_of_typ (typ : core_type) "Cannot construct decoder for %s: cannot decode explicitly polymorphic \ types" (string_of_core_type typ) + | { ptyp_desc = Ptyp_any; _ } -> + Location.raise_errorf ~loc + "Cannot construct decoder for %s: cannot decode wildcard in type " + (string_of_core_type typ) | _ -> Location.raise_errorf ~loc "Cannot construct decoder for %s" (string_of_core_type typ) diff --git a/src/encoders_deriver.ml b/src/encoders_deriver.ml index e98d601..d4adfc5 100644 --- a/src/encoders_deriver.ml +++ b/src/encoders_deriver.ml @@ -86,6 +86,10 @@ let rec expr_of_typ (typ : core_type) : expression = "Cannot construct encoder for %s: cannot encode explicitly polymorphic \ types" (string_of_core_type typ) + | { ptyp_desc = Ptyp_any _; _ } -> + Location.raise_errorf ~loc + "Cannot construct encoder for %s: cannot encode wildcard in type " + (string_of_core_type typ) | _ -> Location.raise_errorf ~loc "Cannot construct encoder for %s" (string_of_core_type typ)