@@ -580,17 +580,28 @@ let name_of_core_type ~prefix = function
580580 { loc = ptyp_loc; txt = sprintf " __param_%s_%s" prefix var }
581581 | { ptyp_desc = Ptyp_any ; ptyp_loc; _ } ->
582582 raise_errorf ~loc: ptyp_loc " Generalized algebraic datatypes not supported"
583- | { ptyp_desc = Ptyp_arrow (_ , _ , _ ); _} -> failwith " Ptyp_arrow "
584- | { ptyp_desc = Ptyp_tuple _ ; _} -> failwith " Ptyp_tuple "
585- | { ptyp_desc = Ptyp_constr (_ , _ ); _} -> failwith " Ptyp_constr "
586- | { ptyp_desc = Ptyp_object (_ , _ ); _} -> failwith " Ptyp_object "
587- | { ptyp_desc = Ptyp_class (_ , _ ); _} -> failwith " Ptyp_class "
588- | { ptyp_desc = Ptyp_alias (_ , _ ); _} -> failwith " Ptyp_alias "
589- | { ptyp_desc = Ptyp_variant (_ , _ , _ ); _} -> failwith " Ptyp_variant "
590- | { ptyp_desc = Ptyp_poly (_ , _ ); _} -> failwith " Ptyp_poly "
591- | { ptyp_desc = Ptyp_package _ ; _} -> failwith " Ptyp_package "
592- | { ptyp_desc = Ptyp_extension _ ; _} -> failwith " Ptyp_extension "
593- | { ptyp_desc = Ptyp_open _ ; _} -> failwith " Ptyp_open "
583+ | { ptyp_desc = Ptyp_arrow (_ , _ , _ ); ptyp_loc; _} ->
584+ raise_errorf ~loc: ptyp_loc " Function types are not supported as type parameters"
585+ | { ptyp_desc = Ptyp_tuple _ ; ptyp_loc; _} ->
586+ raise_errorf ~loc: ptyp_loc " Tuple types are not supported as type parameters"
587+ | { ptyp_desc = Ptyp_constr (_ , _ ); ptyp_loc; _} ->
588+ raise_errorf ~loc: ptyp_loc " Constructed types are not supported as type parameters"
589+ | { ptyp_desc = Ptyp_object (_ , _ ); ptyp_loc; _} ->
590+ raise_errorf ~loc: ptyp_loc " Object types are not supported as type parameters"
591+ | { ptyp_desc = Ptyp_class (_ , _ ); ptyp_loc; _} ->
592+ raise_errorf ~loc: ptyp_loc " Class types are not supported as type parameters"
593+ | { ptyp_desc = Ptyp_alias (_ , _ ); ptyp_loc; _} ->
594+ raise_errorf ~loc: ptyp_loc " Aliased types are not supported as type parameters"
595+ | { ptyp_desc = Ptyp_variant (_ , _ , _ ); ptyp_loc; _} ->
596+ raise_errorf ~loc: ptyp_loc " Polymorphic variants are not supported as type parameters"
597+ | { ptyp_desc = Ptyp_poly (_ , _ ); ptyp_loc; _} ->
598+ raise_errorf ~loc: ptyp_loc " Polymorphic types are not supported as type parameters"
599+ | { ptyp_desc = Ptyp_package _ ; ptyp_loc; _} ->
600+ raise_errorf ~loc: ptyp_loc " First-class module package types are not supported as type parameters"
601+ | { ptyp_desc = Ptyp_extension _ ; ptyp_loc; _} ->
602+ raise_errorf ~loc: ptyp_loc " Extension types are not supported as type parameters"
603+ | { ptyp_desc = Ptyp_open _ ; ptyp_loc; _} ->
604+ raise_errorf ~loc: ptyp_loc " Open types are not supported as type parameters"
594605
595606
596607let rec is_recursive_ct types = function
0 commit comments