Skip to content

Commit

Permalink
Merge PR #18195: Fix cbv evar case
Browse files Browse the repository at this point in the history
Reviewed-by: ppedrot
Reviewed-by: herbelin
Co-authored-by: ppedrot <ppedrot@users.noreply.github.com>
  • Loading branch information
coqbot-app[bot] and ppedrot committed Oct 30, 2023
2 parents 9bcf1d6 + 11b78a1 commit 03e9548
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doc/changelog/04-tactics/18195-rewrite-rules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- **Fixed:**
Apply substitution in Case stack node for cbv reify
(`#18195 <https://github.com/coq/coq/pull/18195>`_,
fixes `#18194 <https://github.com/coq/coq/issues/18194>`_,
by Yann Leray).
2 changes: 1 addition & 1 deletion pretyping/cbv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ let rec reify_stack t = function
reify_stack (mkApp(t,Array.map_of_list reify_value args)) st
| CASE (u,pms,ty,br,iv,ci,env,st) ->
reify_stack
(mkCase (ci, u, pms, ty, iv, t,br))
(apply_env env @@ mkCase (ci, u, pms, ty, iv, t,br))
st
| PROJ (p, st) ->
reify_stack (mkProj (p, t)) st
Expand Down
19 changes: 19 additions & 0 deletions test-suite/bugs/bug_18194.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Require Import Coq.Program.Tactics.

Program Definition a := Eval cbv zeta in (fun (a : True) => (?[A] : nat),
let r :=
let b := I in match tt with tt => b end
in
?A@{a := r},
fun (a : True) => (eq_refl : ?A = _)).

Next Obligation.
destruct a; exact 0.
Defined.
(* This used to fail with the message:
File "test-suite/bugs/bug_18194.v", line 12, characters 0-8:
Error:
Unbound reference: In environment
anonymous' : unit
The reference 3 is free.
*)

0 comments on commit 03e9548

Please sign in to comment.