aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Dénès2017-08-31 12:41:12 +0200
committerMaxime Dénès2017-08-31 12:41:12 +0200
commitb8ddc6e8b7788bfdb92ebd5238ca92c633b3e092 (patch)
treef4338fa301a1d71f4e74eb681c9692591c2423c8
parent8f04b4714f2a797b98be4d87866af3d93ecb78b6 (diff)
parentae43495dee6e3f4ab407a49050ea2546ab6bd428 (diff)
Merge PR #994: Fix BZ#5245 hnf on projections with simpl never flag
-rw-r--r--pretyping/tacred.ml6
-rw-r--r--test-suite/bugs/closed/5245.v18
2 files changed, 24 insertions, 0 deletions
diff --git a/pretyping/tacred.ml b/pretyping/tacred.ml
index 76f35f76f5..708788ab87 100644
--- a/pretyping/tacred.ml
+++ b/pretyping/tacred.ml
@@ -557,6 +557,12 @@ let match_eval_ref_value env sigma constr stack =
Some (EConstr.of_constr (constant_value_in env (sp, u)))
else
None
+ | Proj (p, c) when not (Projection.unfolded p) ->
+ reduction_effect_hook env sigma (EConstr.to_constr sigma constr)
+ (lazy (EConstr.to_constr sigma (applist (constr,stack))));
+ if is_evaluable env (EvalConstRef (Projection.constant p)) then
+ Some (mkProj (Projection.unfold p, c))
+ else None
| Var id when is_evaluable env (EvalVarRef id) ->
env |> lookup_named id |> NamedDecl.get_value
| Rel n ->
diff --git a/test-suite/bugs/closed/5245.v b/test-suite/bugs/closed/5245.v
new file mode 100644
index 0000000000..77bf169e18
--- /dev/null
+++ b/test-suite/bugs/closed/5245.v
@@ -0,0 +1,18 @@
+Set Primitive Projections.
+
+Record foo := Foo {
+ foo_car : Type;
+ foo_rel : foo_car -> foo_car -> Prop
+}.
+Arguments foo_rel : simpl never.
+
+Definition foo_fun {A B} := Foo (A -> B) (fun f g => forall x, f x = g x).
+
+Goal @foo_rel foo_fun (fun x : nat => x) (fun x => x).
+Proof.
+intros x; exact eq_refl.
+Undo.
+progress hnf; intros; exact eq_refl.
+Undo.
+unfold foo_rel. intros x. exact eq_refl.
+Qed. \ No newline at end of file