aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/glob_ops.ml
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-19 19:13:23 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-19 19:40:13 +0200
commit75a48bfc6b91f1e5095d9cdfbcc0ae2bf8cf16ec (patch)
tree3954479b911b7681255764be0bcb13d72f52e8bd /pretyping/glob_ops.ml
parentb038ff00e3d1873bed580c13df1b18ce0510abb2 (diff)
Fixing #4677 (collision of a global variable and of a local variable
while eta-expanding a notation) + a more serious variant of it (alpha-conversion incorrect wrt eta-expansion).
Diffstat (limited to 'pretyping/glob_ops.ml')
-rw-r--r--pretyping/glob_ops.ml12
1 files changed, 11 insertions, 1 deletions
diff --git a/pretyping/glob_ops.ml b/pretyping/glob_ops.ml
index c9860864a..e3b6fb08a 100644
--- a/pretyping/glob_ops.ml
+++ b/pretyping/glob_ops.ml
@@ -266,7 +266,7 @@ let add_name_to_ids set na =
| Anonymous -> set
| Name id -> Id.Set.add id set
-let free_glob_vars =
+let free_glob_vars =
let rec vars bounded vs = function
| GVar (loc,id') -> if Id.Set.mem id' bounded then vs else Id.Set.add id' vs
| GApp (loc,f,args) -> List.fold_left (vars bounded) vs (f::args)
@@ -324,6 +324,16 @@ let free_glob_vars =
let vs = vars Id.Set.empty Id.Set.empty rt in
Id.Set.elements vs
+let glob_visible_short_qualid c =
+ let rec aux acc = function
+ | GRef (_,c,_) ->
+ let qualid = Nametab.shortest_qualid_of_global Id.Set.empty c in
+ let dir,id = Libnames.repr_qualid qualid in
+ if DirPath.is_empty dir then id :: acc else acc
+ | c ->
+ fold_glob_constr aux acc c
+ in aux [] c
+
let add_and_check_ident id set =
if Id.Set.mem id set then
Pp.(msg_warning