aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoq2003-01-22 10:04:13 +0000
committercoq2003-01-22 10:04:13 +0000
commit314333e2ce7c06293ab6e5292b2927afb75b6a6f (patch)
tree0af2af425e99e771a9279616850f660a97a1f60b
parente4c997965f822488376fde2bb34285d3ec943a20 (diff)
Bug 'with Module' corrige
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@3573 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--kernel/mod_typing.ml10
-rw-r--r--kernel/modops.ml3
-rw-r--r--kernel/modops.mli2
-rw-r--r--library/declaremods.ml30
4 files changed, 31 insertions, 14 deletions
diff --git a/kernel/mod_typing.ml b/kernel/mod_typing.ml
index 7417b42619..8fee8481d7 100644
--- a/kernel/mod_typing.ml
+++ b/kernel/mod_typing.ml
@@ -108,7 +108,15 @@ and merge_with env mtb with_decl =
| _ -> error_not_a_module (string_of_label l)
in
let mtb = type_modpath env' mp in
- (* here, we should assert that there is no msid in mtb *)
+ (* here, using assertions in substitutions,
+ we check that there is no msid bound in mtb *)
+ begin
+ try
+ let _ = subst_modtype (map_msid msid (MPself msid)) mtb in
+ ()
+ with
+ Assert_failure _ -> error_circular_with_module id
+ end;
let cst = check_subtypes env' mtb old.msb_modtype in
let equiv =
match old.msb_equiv with
diff --git a/kernel/modops.ml b/kernel/modops.ml
index ec25459a9f..c194a6c712 100644
--- a/kernel/modops.ml
+++ b/kernel/modops.ml
@@ -74,6 +74,9 @@ let error_local_context lo =
error ("The local context of the component "^
(string_of_label l)^" is not empty")
+let error_circular_with_module l =
+ error ("The construction \"with Module "^(string_of_id l)^":=...\" is about to create\na circular module type. Their resolution is not implemented yet.\nIf you really need that feature, please report.")
+
let rec scrape_modtype env = function
| MTBident kn -> scrape_modtype env (lookup_modtype kn env)
| mtb -> mtb
diff --git a/kernel/modops.mli b/kernel/modops.mli
index aaff572235..1391380b19 100644
--- a/kernel/modops.mli
+++ b/kernel/modops.mli
@@ -92,3 +92,5 @@ val error_not_a_constant : label -> 'a
val error_with_incorrect : label -> 'a
val error_local_context : label option -> 'a
+
+val error_circular_with_module : identifier -> 'a
diff --git a/library/declaremods.ml b/library/declaremods.ml
index 5dba4c208e..58e672433d 100644
--- a/library/declaremods.ml
+++ b/library/declaremods.ml
@@ -500,21 +500,25 @@ let end_module id =
let dir = fst oldprefix in
let msid = msid_of_prefix oldprefix in
+ let substobjs = try
+ match res_o with
+ | None ->
+ empty_subst, mbids, msid, substitute
+ | Some (MTEident ln) ->
+ abstract_substobjs mbids (KNmap.find ln (!modtypetab))
+ | Some (MTEsig (msid,_)) ->
+ todo "Anonymous signatures not supported";
+ empty_subst, mbids, msid, []
+ | Some (MTEwith _ as mty) ->
+ abstract_substobjs mbids (get_modtype_substobjs mty)
+ | Some (MTEfunsig _) ->
+ anomaly "Funsig cannot be here..."
+ with
+ Not_found -> anomaly "Module objects not found..."
+ in
+
Summary.unfreeze_other_summaries fs;
- let substobjs = match res_o with
- | None ->
- empty_subst, mbids, msid, substitute
- | Some (MTEident ln) ->
- abstract_substobjs mbids (KNmap.find ln (!modtypetab))
- | Some (MTEsig (msid,_)) ->
- todo "Anonymous signatures not supported";
- empty_subst, mbids, msid, []
- | Some (MTEwith _ as mty) ->
- abstract_substobjs mbids (get_modtype_substobjs mty)
- | Some (MTEfunsig _) ->
- anomaly "Funsig cannot be here..."
- in
let substituted = subst_substobjs dir mp substobjs in
let node = in_module (None,substobjs,substituted) in
let objects =