summaryrefslogtreecommitdiff
path: root/test-suite/success/guard.v
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@debian.org>2018-12-29 14:31:27 -0500
committerGravatar Benjamin Barenblat <bbaren@debian.org>2018-12-29 14:31:27 -0500
commit9043add656177eeac1491a73d2f3ab92bec0013c (patch)
tree2b0092c84bfbf718eca10c81f60b2640dc8cab05 /test-suite/success/guard.v
parenta4c7f8bd98be2a200489325ff7c5061cf80ab4f3 (diff)
Imported Upstream version 8.8.2upstream/8.8.2
Diffstat (limited to 'test-suite/success/guard.v')
-rw-r--r--test-suite/success/guard.v17
1 files changed, 17 insertions, 0 deletions
diff --git a/test-suite/success/guard.v b/test-suite/success/guard.v
index b9181d43..3a1c6dab 100644
--- a/test-suite/success/guard.v
+++ b/test-suite/success/guard.v
@@ -9,3 +9,20 @@ Check let x (f:nat->nat) k := f k in
| 0 => 0
| S k => f F k (* here Rel 3 = F ! *)
end.
+
+(** Commutation of guard condition allows recursive calls on functional arguments,
+ despite rewriting in their domain types. *)
+Inductive foo : Type -> Type :=
+| End A : foo A
+| Next A : (A -> foo A) -> foo A.
+
+Definition nat : Type := nat.
+
+Fixpoint bar (A : Type) (e : nat = A) (f : foo A) {struct f} : nat :=
+match f with
+| End _ => fun _ => O
+| Next A g => fun e =>
+ match e in (_ = B) return (B -> foo A) -> nat with
+ | eq_refl => fun (g' : nat -> foo A) => bar A e (g' O)
+ end g
+end e.