Skip to content

Commit

Permalink
Adapt to coq/coq#18280 (case relevance outside case info) (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySkimmer authored Nov 13, 2023
1 parent 1e001e7 commit 3e84ec2
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ src/Rewriter/Util/plugins/ltac2_extra_plugin.mlg
src/Rewriter/Util/plugins/ltac2_extra_plugin.mllib

src/Rewriter/Util/Tactics2/Constr.v
src/Rewriter/Util/Tactics2/DestCase.v
src/Rewriter/Util/Tactics2/DestProj.v
src/Rewriter/Util/Tactics2/Proj.v

Expand Down
1 change: 1 addition & 0 deletions Makefile.local.common
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ COMPATIBILITY_FILES := \
src/Rewriter/Util/plugins/StrategyTactic.v \
src/Rewriter/Util/plugins/Ltac2Extra.v \
src/Rewriter/Util/Tactics2/Constr.v \
src/Rewriter/Util/Tactics2/DestCase.v \
src/Rewriter/Util/Tactics2/DestProj.v \
src/Rewriter/Util/Tactics2/Proj.v \
#
4 changes: 3 additions & 1 deletion src/Rewriter/Language/Reify.v
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.String.
Require Rewriter.Util.Tactics2.Constr.
Require Import Rewriter.Util.Tactics2.DestEvar.
Require Import Rewriter.Util.Tactics2.DestCase.
Require Import Rewriter.Util.Tactics2.InstantiateEvar.
Require Import Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Import Rewriter.Util.Tactics2.FixNotationsForPerformance.
Expand Down Expand Up @@ -510,8 +511,9 @@ Module Compilers.
reify_preprocess v
end
end
| Constr.Unsafe.Case cinfo ret_ty cinv x branches
| Constr.Unsafe.Case _ _ _ _ _
=> Reify.debug_enter_reify_case "expr.reify_preprocess" "Case" term;
let (cinfo, ret_ty, cinv, x, branches) := destCase term in
match Constr.Unsafe.kind ret_ty with
| Constr.Unsafe.Lambda xb ret_ty
=> let ty := Constr.Unsafe.substnl [x] 0 ret_ty in
Expand Down
4 changes: 2 additions & 2 deletions src/Rewriter/Util/Tactics2/Constr.v.v819
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Module Unsafe.
| Case _ x iv y bl
=> Array.iter f bl;
Case.iter_invert f iv;
f x;
match x with (x,_) => f x end;
f y
| Proj _p _ c => f c
| Fix _ _ tl bl =>
Expand Down Expand Up @@ -82,7 +82,7 @@ Module Unsafe.
| Case _ x iv y bl
=> Array.iter (f n) bl;
Case.iter_invert (f n) iv;
f n x;
match x with (x,_) => f n x end;
f n y
| Proj _p _ c => f n c
| Fix _ _ tl bl =>
Expand Down
1 change: 1 addition & 0 deletions src/Rewriter/Util/Tactics2/DestCase.v.v815
1 change: 1 addition & 0 deletions src/Rewriter/Util/Tactics2/DestCase.v.v816
1 change: 1 addition & 0 deletions src/Rewriter/Util/Tactics2/DestCase.v.v817
File renamed without changes.
11 changes: 11 additions & 0 deletions src/Rewriter/Util/Tactics2/DestCase.v.v819
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Require Import Ltac2.Ltac2.
Require Export Rewriter.Util.FixCoqMistakes.
Import Ltac2.Constr.Unsafe.

Ltac2 Type exn ::= [ Not_a_case (kind) ].
Ltac2 destCase (c : constr) :=
let k := kind c in
match k with
| Case a b c d e => let (b,_) := b in (a, b, c, d, e)
| _ => Control.throw (Not_a_case k)
end.

0 comments on commit 3e84ec2

Please sign in to comment.