aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-01-28 19:02:20 +0100
committerPierre-Marie Pédrot2017-01-28 19:13:56 +0100
commit6e4c4578044c15ec172009a570d13b9e168cb93e (patch)
tree8a53da7b5f3c389f34d9323d77598452b7e7d164
parent22e2e5722d233bbd939cd235650497e30e506e63 (diff)
Fix bug #5262: Error should tell me which name is duplicated.
-rw-r--r--toplevel/record.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/toplevel/record.ml b/toplevel/record.ml
index ef09f6fa54..b8dcf81fde 100644
--- a/toplevel/record.ml
+++ b/toplevel/record.ml
@@ -550,8 +550,10 @@ let definition_structure (kind,poly,finite,(is_coe,((loc,idstruc),pl)),ps,cfs,id
| Vernacexpr.DefExpr ((_,Name id),_,_) -> id::acc
| _ -> acc in
let allnames = idstruc::(List.fold_left extract_name [] fs) in
- if not (List.distinct_f Id.compare allnames)
- then error "Two objects have the same name";
+ let () = match List.duplicates Id.equal allnames with
+ | [] -> ()
+ | id :: _ -> errorlabstrm "" (str "Two objects have the same name" ++ spc () ++ quote (Id.print id))
+ in
let isnot_class = match kind with Class false -> false | _ -> true in
if isnot_class && List.exists (fun opt -> not (Option.is_empty opt)) priorities then
error "Priorities only allowed for type class substructures";