Automatically wrap fields with Ptyp_poly.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12789 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2012-07-27 17:11:05 +00:00
parent b827363738
commit e81cd4ac29
1 changed files with 9 additions and 1 deletions

View File

@ -142,7 +142,15 @@ module T = struct
let package ?loc a b = mk ?loc (Ptyp_package (a, b))
let field_type ?(loc = Location.none) x = {pfield_desc = x; pfield_loc = loc}
let field ?loc s t = field_type ?loc (Pfield (s, t))
let field ?loc s t =
let t =
(* The type-checker expects the field to be a Ptyp_poly. Maybe
it should wrap the type automatically... *)
match t.ptyp_desc with
| Ptyp_poly _ -> t
| _ -> poly ?loc [] t
in
field_type ?loc (Pfield (s, t))
let field_var ?loc () = field_type ?loc Pfield_var
let core_field_type sub = function