aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-09-03 23:52:12 +0200
committerPierre-Marie Pédrot2017-09-04 00:40:56 +0200
commit102cfe76bc42d3139c79eca59eb782fcf644317b (patch)
tree6f371c06566e7638fdb72c43c36bfa95f90724e6 /tests
parent34912844e18ef84d88af87e1dca05ab0426871c9 (diff)
Implementing lazy matching over terms.
Diffstat (limited to 'tests')
-rw-r--r--tests/matching.v17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/matching.v b/tests/matching.v
new file mode 100644
index 0000000000..d21c505cdf
--- /dev/null
+++ b/tests/matching.v
@@ -0,0 +1,17 @@
+Require Import Ltac2.Ltac2 Ltac2.Notations.
+
+Goal True -> False.
+Proof.
+Fail
+let b := { contents := true } in
+let f c :=
+ match b.(contents) with
+ | true => Message.print (Message.of_constr c); b.(contents) := false; fail
+ | false => ()
+ end
+in
+(** This fails because the matching is not allowed to backtrack once
+ it commits to a branch*)
+lazy_match! '(nat -> bool) with context [?a] => f a end.
+lazy_match! Control.goal () with ?a -> ?b => Message.print (Message.of_constr b) end.
+Abort.