diff options
| author | Matthieu Sozeau | 2014-06-17 11:18:10 +0200 |
|---|---|---|
| committer | Matthieu Sozeau | 2014-06-17 15:42:14 +0200 |
| commit | b8834d66013b38cef247507f312bb081de04da27 (patch) | |
| tree | 13bf7e5c58c160eac0dafa6d36e9f7a9ad6745e9 | |
| parent | 0091c528cb1b0171215a6ef5a47f26763a4edc09 (diff) | |
Existing Class now works with universe polymorphism. Fixes HoTT bug #063
| -rw-r--r-- | pretyping/typeclasses.ml | 7 | ||||
| -rw-r--r-- | test-suite/bugs/closed/HoTT_coq_063.v (renamed from test-suite/bugs/opened/HoTT_coq_063.v) | 20 |
2 files changed, 18 insertions, 9 deletions
diff --git a/pretyping/typeclasses.ml b/pretyping/typeclasses.ml index 8364387783..dd09d5b29a 100644 --- a/pretyping/typeclasses.ml +++ b/pretyping/typeclasses.ml @@ -403,9 +403,9 @@ let add_class cl = open Declarations -(* FIXME: deal with universe instances *) + let add_constant_class cst = - let ty = Typeops.type_of_constant_in (Global.env ()) (cst,Univ.Instance.empty) in + let ty = Universes.unsafe_type_of_global (ConstRef cst) in let ctx, arity = decompose_prod_assum ty in let tc = { cl_impl = ConstRef cst; @@ -420,9 +420,10 @@ let add_inductive_class ind = let mind, oneind = Global.lookup_inductive ind in let k = let ctx = oneind.mind_arity_ctxt in + let inst = Univ.UContext.instance mind.mind_universes in let ty = Inductive.type_of_inductive_knowing_parameters (push_rel_context ctx (Global.env ())) - ((mind,oneind),Univ.Instance.empty) + ((mind,oneind),inst) (Array.map (fun x -> lazy x) (Termops.extended_rel_vect 0 ctx)) in { cl_impl = IndRef ind; diff --git a/test-suite/bugs/opened/HoTT_coq_063.v b/test-suite/bugs/closed/HoTT_coq_063.v index 8656fadaa9..777f6483d5 100644 --- a/test-suite/bugs/opened/HoTT_coq_063.v +++ b/test-suite/bugs/closed/HoTT_coq_063.v @@ -8,9 +8,13 @@ Module A. | BuildContr : forall A (center : A) (contr : forall y, center = y), IsTrunc 0 A | trunc_S : forall A n, (forall x y : A, IsTrunc n (x = y)) -> IsTrunc (S n) A. - Fail Existing Class IsTrunc. - (* Anomaly: Mismatched instance and context when building universe substitution. -Please report. *) + Existing Class IsTrunc. + + + Instance is_trunc_unit : IsTrunc 0 unit. + Proof. apply BuildContr with (center:=tt). now intros []. Defined. + + Check (_ : IsTrunc 0 unit). End A. Module B. @@ -20,7 +24,11 @@ Module B. | S _ => False end. - Fail Existing Class IsTrunc. - (* Anomaly: Mismatched instance and context when building universe substitution. -Please report. *) + Existing Class IsTrunc. + + Instance is_trunc_unit : IsTrunc 0 unit. + Proof. exact I. Defined. + + Check (_ : IsTrunc 0 unit). + Fail Definition foo := (_ : IsTrunc 1 unit). End B. |
