From f75e1b5d8a4f679c839ffa327baa590198c69640 Mon Sep 17 00:00:00 2001 From: Kenji Maillard Date: Mon, 4 Nov 2019 23:29:40 +0100 Subject: Prevent redefinition of Ltac2 types; fix #10097 --- user-contrib/Ltac2/tac2entries.ml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'user-contrib') 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 -- cgit v1.2.3