diff options
| author | Maxime Dénès | 2015-10-15 14:21:45 +0200 |
|---|---|---|
| committer | Maxime Dénès | 2015-10-15 14:36:30 +0200 |
| commit | 44817bf722eacb0379bebc7e435bfafa503d574f (patch) | |
| tree | 210ffe37ee7e1d06f6a3b0b2a28b6bd192243c0d /pretyping | |
| parent | 3116aeff0cdc51e6801f3e8ae4a6c0533e1a75ac (diff) | |
Fix #4346 2/2: VM casts were not inferring universe constraints.
Diffstat (limited to 'pretyping')
| -rw-r--r-- | pretyping/nativenorm.ml | 4 | ||||
| -rw-r--r-- | pretyping/pretyping.ml | 11 | ||||
| -rw-r--r-- | pretyping/reductionops.ml | 3 | ||||
| -rw-r--r-- | pretyping/reductionops.mli | 2 | ||||
| -rw-r--r-- | pretyping/vnorm.ml | 4 | ||||
| -rw-r--r-- | pretyping/vnorm.mli | 4 |
6 files changed, 14 insertions, 14 deletions
diff --git a/pretyping/nativenorm.ml b/pretyping/nativenorm.ml index 949a28a1f4..dafe88d8db 100644 --- a/pretyping/nativenorm.ml +++ b/pretyping/nativenorm.ml @@ -405,6 +405,6 @@ let native_norm env sigma c ty = let native_conv_generic pb sigma t = Nativeconv.native_conv_gen pb (evars_of_evar_map sigma) t -let native_infer_conv ?(pb=Reduction.CUMUL) env sigma x y = +let native_infer_conv ?(pb=Reduction.CUMUL) env sigma t1 t2 = Reductionops.infer_conv_gen (fun pb ~l2r sigma ts -> native_conv_generic pb sigma) - ~catch_incon:true ~pb env sigma x y + ~catch_incon:true ~pb env sigma t1 t2 diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml index e1e8982e1e..f6c1867285 100644 --- a/pretyping/pretyping.ml +++ b/pretyping/pretyping.ml @@ -929,14 +929,11 @@ let rec pretype k0 resolve_tc (tycon : type_constraint) env evdref (lvar : ltac_ let cj = pretype empty_tycon env evdref lvar c in let cty = nf_evar !evdref cj.uj_type and tval = nf_evar !evdref tj.utj_val in if not (occur_existential cty || occur_existential tval) then - begin - try - let env = Environ.push_context_set (Evd.universe_context_set !evdref) env in - ignore (Reduction.vm_conv Reduction.CUMUL env cty tval); cj - with Reduction.NotConvertible -> - error_actual_type_loc loc env !evdref cj tval + let (evd,b) = Vnorm.vm_infer_conv env !evdref cty tval in + if b then (evdref := evd; cj) + else + error_actual_type_loc loc env !evdref cj tval (ConversionFailed (env,cty,tval)) - end else user_err_loc (loc,"",str "Cannot check cast with vm: " ++ str "unresolved arguments remain.") | NATIVEcast -> diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml index a24773b6e6..d25e273a3e 100644 --- a/pretyping/reductionops.ml +++ b/pretyping/reductionops.ml @@ -1251,9 +1251,6 @@ let pb_equal = function | Reduction.CUMUL -> Reduction.CONV | Reduction.CONV -> Reduction.CONV -let sort_cmp cv_pb s1 s2 u = - Reduction.check_sort_cmp_universes cv_pb s1 s2 u - let test_trans_conversion (f: ?l2r:bool-> ?evars:'a->'b) reds env sigma x y = try let evars ev = safe_evar_value sigma ev in diff --git a/pretyping/reductionops.mli b/pretyping/reductionops.mli index b179dbc95e..42c2c9c6e6 100644 --- a/pretyping/reductionops.mli +++ b/pretyping/reductionops.mli @@ -251,8 +251,6 @@ type conversion_test = constraints -> constraints val pb_is_equal : conv_pb -> bool val pb_equal : conv_pb -> conv_pb -val sort_cmp : env -> conv_pb -> sorts -> sorts -> universes -> unit - val is_conv : env -> evar_map -> constr -> constr -> bool val is_conv_leq : env -> evar_map -> constr -> constr -> bool val is_fconv : conv_pb -> env -> evar_map -> constr -> constr -> bool diff --git a/pretyping/vnorm.ml b/pretyping/vnorm.ml index f768e4feef..2c6ac7a292 100644 --- a/pretyping/vnorm.ml +++ b/pretyping/vnorm.ml @@ -312,3 +312,7 @@ and nf_cofix env cf = let cbv_vm env c t = let v = Vconv.val_of_constr env c in nf_val env v t + +let vm_infer_conv ?(pb=Reduction.CUMUL) env sigma t1 t2 = + Reductionops.infer_conv_gen (fun pb ~l2r sigma ts -> Vconv.vm_conv_gen pb) + ~catch_incon:true ~pb env sigma t1 t2 diff --git a/pretyping/vnorm.mli b/pretyping/vnorm.mli index 7dabbc6cb0..99856a8d9a 100644 --- a/pretyping/vnorm.mli +++ b/pretyping/vnorm.mli @@ -8,7 +8,11 @@ open Term open Environ +open Evd (** {6 Reduction functions } *) val cbv_vm : env -> constr -> types -> constr +(** Conversion with inference of universe constraints *) +val vm_infer_conv : ?pb:conv_pb -> env -> evar_map -> constr -> constr -> + evar_map * bool |
