aboutsummaryrefslogtreecommitdiff
path: root/user-contrib
diff options
context:
space:
mode:
authorKenji Maillard2019-11-04 23:29:40 +0100
committerKenji Maillard2019-11-04 23:47:46 +0100
commitf75e1b5d8a4f679c839ffa327baa590198c69640 (patch)
tree9dd90229c10d35ae063da906e822a93628cf8539 /user-contrib
parent634cb7b8a07a34fc29d074591091f0a6170f7bff (diff)
Prevent redefinition of Ltac2 types; fix #10097
Diffstat (limited to 'user-contrib')
-rw-r--r--user-contrib/Ltac2/tac2entries.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/user-contrib/Ltac2/tac2entries.ml b/user-contrib/Ltac2/tac2entries.ml
index 92bc49346f..b8853f3755 100644
--- a/user-contrib/Ltac2/tac2entries.ml
+++ b/user-contrib/Ltac2/tac2entries.ml
@@ -374,6 +374,15 @@ let register_typedef ?(local = false) isrec types =
| ({loc;v=id}, _) :: _ ->
user_err ?loc (str "Multiple definition of the type name " ++ Id.print id)
in
+ let () =
+ let check_existing_type ({v=id},_) =
+ let qid = Libnames.make_qualid (Lib.current_dirpath false) id in
+ try let _ = Tac2env.locate_type qid in
+ user_err (str "Multiple definition of the type name " ++ pr_qualid qid)
+ with Not_found -> ()
+ in
+ List.iter check_existing_type types
+ in
let check ({loc;v=id}, (params, def)) =
let same_name {v=id1} {v=id2} = Id.equal id1 id2 in
let () = match List.duplicates same_name params with