From 29791fc19fca7b78094c3c0b08348adf3c1dcead Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 14 Feb 2004 17:38:02 +0000 Subject: [PATCH] Ajout alpha-conversion manquante dans la construction 'SIG with ...' (PR#1968) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6116 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- typing/mtype.ml | 3 +++ typing/mtype.mli | 3 +++ typing/typemod.ml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/typing/mtype.ml b/typing/mtype.ml index 0b4805c14..417697397 100644 --- a/typing/mtype.ml +++ b/typing/mtype.ml @@ -28,6 +28,9 @@ let rec scrape env mty = end | _ -> mty +let freshen mty = + Subst.modtype Subst.identity mty + let rec strengthen env mty p = match scrape env mty with Tmty_signature sg -> diff --git a/typing/mtype.mli b/typing/mtype.mli index ee720be28..abb66b969 100644 --- a/typing/mtype.mli +++ b/typing/mtype.mli @@ -20,6 +20,9 @@ val scrape: Env.t -> module_type -> module_type (* Expand toplevel module type abbreviations till hitting a "hard" module type (signature, functor, or abstract module type ident. *) +val freshen: module_type -> module_type + (* Return an alpha-equivalent copy of the given module type + where bound identifiers are fresh. *) val strengthen: Env.t -> module_type -> Path.t -> module_type (* Strengthen abstract type components relative to the given path. *) diff --git a/typing/typemod.ml b/typing/typemod.ml index 00e87b60e..294f8a005 100644 --- a/typing/typemod.ml +++ b/typing/typemod.ml @@ -237,7 +237,7 @@ let rec transl_modtype env smty = (fun sg (lid, sdecl) -> merge_constraint env smty.pmty_loc sg lid sdecl) init_sg constraints in - Tmty_signature final_sg + Mtype.freshen (Tmty_signature final_sg) and transl_signature env sg = let type_names = ref StringSet.empty