aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Sozeau2017-08-24 16:36:52 +0200
committerMatthieu Sozeau2017-08-25 14:03:48 +0200
commitae43495dee6e3f4ab407a49050ea2546ab6bd428 (patch)
tree535d685cb69430becfb7c922cda0336cae50a76d
parent7b1ff0c70a3ba9cd3cfa5aa6723f8f8a2b6e5396 (diff)
primproj: fix bug 5245, hnf on proj 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