summaryrefslogtreecommitdiff
path: root/typing/env.ml
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-05-14 09:48:20 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-05-14 09:48:20 +0000
commit4d7abfbc16022eab8af392bd3e6d76cf4773f2c2 (patch)
treee883430c77d37c7c933652bca86be8dcc3697272 /typing/env.ml
parent6ef3a9c5a2ca32049682798e1e6f4521ea196836 (diff)
downloadocaml-multimatch.tar.gz
merge from HEADmultimatch
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/multimatch@5563 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing/env.ml')
-rw-r--r--typing/env.ml19
1 files changed, 12 insertions, 7 deletions
diff --git a/typing/env.ml b/typing/env.ml
index 1e93b40ff8..33788d4796 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -363,7 +363,7 @@ and lookup_class =
lookup (fun env -> env.classes) (fun sc -> sc.comp_classes)
and lookup_cltype =
lookup (fun env -> env.cltypes) (fun sc -> sc.comp_cltypes)
-
+
(* Expand manifest module type names at the top of the given module type *)
let rec scrape_modtype mty env =
@@ -379,22 +379,27 @@ let rec scrape_modtype mty env =
(* Compute constructor descriptions *)
let constructors_of_type ty_path decl =
- match decl.type_kind with
- Type_variant cstrs ->
+ let rec constructors_of_tkind = function
+ | Type_variant cstrs ->
Datarepr.constructor_descrs
(Btype.newgenty (Tconstr(ty_path, decl.type_params, ref Mnil)))
cstrs
- | _ -> []
+ | Type_private tkind -> constructors_of_tkind tkind
+ | Type_record _ | Type_abstract -> [] in
+ constructors_of_tkind decl.type_kind
+
(* Compute label descriptions *)
let labels_of_type ty_path decl =
- match decl.type_kind with
- Type_record(labels, rep) ->
+ let rec labels_of_tkind = function
+ | Type_record(labels, rep) ->
Datarepr.label_descrs
(Btype.newgenty (Tconstr(ty_path, decl.type_params, ref Mnil)))
labels rep
- | _ -> []
+ | Type_private tkind -> labels_of_tkind tkind
+ | Type_variant _ | Type_abstract -> [] in
+ labels_of_tkind decl.type_kind
(* Given a signature and a root path, prefix all idents in the signature
by the root path and build the corresponding substitution. *)