aboutsummaryrefslogtreecommitdiff
path: root/toplevel
diff options
context:
space:
mode:
authorbarras2012-10-17 02:35:08 +0000
committerbarras2012-10-17 02:35:08 +0000
commit9834fe8ac933230607eb33c9cbbaa68a7b13f4fe (patch)
treeeba7cac3370d517aa0bf48a76e383a902426e894 /toplevel
parent927b92eb8e1abf7ff1978f812b602b276d69dd27 (diff)
univ inconsistency error message gives evidence of a cycle
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15898 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'toplevel')
-rw-r--r--toplevel/cerrors.ml28
1 files changed, 19 insertions, 9 deletions
diff --git a/toplevel/cerrors.ml b/toplevel/cerrors.ml
index c6e694902a..0696299b33 100644
--- a/toplevel/cerrors.ml
+++ b/toplevel/cerrors.ml
@@ -63,15 +63,25 @@ let wrap_vernac_error strm =
EvaluatedError (hov 0 (str "Error:" ++ spc () ++ strm), None)
let rec process_vernac_interp_error = function
- | Univ.UniverseInconsistency (o,u,v) ->
- let msg =
- if !Constrextern.print_universes then
- spc() ++ str "(cannot enforce" ++ spc() ++ Univ.pr_uni u ++ spc() ++
- str (match o with Univ.Lt -> "<" | Univ.Le -> "<=" | Univ.Eq -> "=")
- ++ spc() ++ Univ.pr_uni v ++ str")"
- else
- mt() in
- wrap_vernac_error (str "Universe inconsistency" ++ msg ++ str ".")
+ | Univ.UniverseInconsistency (o,u,v,p) ->
+ let pr_rel r =
+ match r with
+ Univ.Eq -> str"=" | Univ.Lt -> str"<" | Univ.Le -> str"<=" in
+ let reason = match p with
+ [] -> mt()
+ | _::_ ->
+ str " because" ++ spc() ++ Univ.pr_uni v ++
+ prlist (fun (r,v) -> spc() ++ pr_rel r ++ str" " ++ Univ.pr_uni v)
+ p ++
+ (if snd (CList.last p)=u then mt() else
+ (spc() ++ str "= " ++ Univ.pr_uni u)) in
+ let msg =
+ if !Constrextern.print_universes then
+ spc() ++ str "(cannot enforce" ++ spc() ++ Univ.pr_uni u ++ spc() ++
+ pr_rel o ++ spc() ++ Univ.pr_uni v ++ reason ++ str")"
+ else
+ mt() in
+ wrap_vernac_error (str "Universe inconsistency" ++ msg ++ str ".")
| TypeError(ctx,te) ->
wrap_vernac_error (Himsg.explain_type_error ctx Evd.empty te)
| PretypeError(ctx,sigma,te) ->