- let t',metasenv' = CicMetaSubst.delift n subst context metasenv l t in
- (n, t')::subst, metasenv'
+ let t',metasenv',subst' =
+ try
+ CicMetaSubst.delift n subst context metasenv l t
+ with
+ (CicMetaSubst.MetaSubstFailure msg)-> raise(UnificationFailure msg)
+ | (CicMetaSubst.Uncertain msg) -> raise (Uncertain msg)
+ in
+ let t'' =
+ match t' with
+ C.Sort (C.Type u) when not test_equality_only ->
+ let u' = CicUniv.fresh () in
+ let s = C.Sort (C.Type u') in
+ ignore (CicUniv.add_ge (upper u u') (lower u u')) ;
+ s
+ | _ -> t'
+ in
+ (n, t'')::subst', metasenv'