aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/univdecls.ml
diff options
context:
space:
mode:
authorGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2017-09-28 22:28:21 +0200
committerGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2017-11-25 14:18:35 +0100
commitf8e639f3b81ae142f5b529be1ad90210fc259375 (patch)
treed73251d05312b34ba8f6e38387c3a07372603588 /pretyping/univdecls.ml
parentd071eac98b7812ac5c03004b438022900885d874 (diff)
Fix interpretation of global universes in univdecl constraints.
Also nicer error when the constraints are impossible.
Diffstat (limited to 'pretyping/univdecls.ml')
-rw-r--r--pretyping/univdecls.ml22
1 files changed, 5 insertions, 17 deletions
diff --git a/pretyping/univdecls.ml b/pretyping/univdecls.ml
index a5266125a..3cf32d7ff 100644
--- a/pretyping/univdecls.ml
+++ b/pretyping/univdecls.ml
@@ -6,9 +6,8 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-open Pp
-open CErrors
open Names
+open CErrors
(** Local universes and constraints declarations *)
type universe_decl =
@@ -22,27 +21,16 @@ let default_univ_decl =
univdecl_extensible_constraints = true }
let interp_univ_constraints env evd cstrs =
- let open Misctypes in
- let u_of_id x =
- match x with
- | Misctypes.GProp -> Loc.tag Univ.Level.prop
- | GSet -> Loc.tag Univ.Level.set
- | GType None | GType (Some (_, Anonymous)) ->
- user_err ~hdr:"interp_constraint"
- (str "Cannot declare constraints on anonymous universes")
- | GType (Some (loc, Name id)) ->
- try loc, Evd.universe_of_name evd id
- with Not_found ->
- user_err ?loc ~hdr:"interp_constraint" (str "Undeclared universe " ++ Id.print id)
- in
let interp (evd,cstrs) (u, d, u') =
- let lloc, ul = u_of_id u and rloc, u'l = u_of_id u' in
+ let ul = Pretyping.interp_known_glob_level evd u in
+ let u'l = Pretyping.interp_known_glob_level evd u' in
let cstr = (ul,d,u'l) in
let cstrs' = Univ.Constraint.add cstr cstrs in
try let evd = Evd.add_constraints evd (Univ.Constraint.singleton cstr) in
evd, cstrs'
with Univ.UniverseInconsistency e ->
- user_err ~hdr:"interp_constraint" (str "Universe inconsistency" (* TODO *))
+ user_err ~hdr:"interp_constraint"
+ (Univ.explain_universe_inconsistency (Termops.pr_evd_level evd) e)
in
List.fold_left interp (evd,Univ.Constraint.empty) cstrs