summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorGravatar qunyanm <unknown>2016-02-26 12:37:46 -0800
committerGravatar qunyanm <unknown>2016-02-26 12:37:46 -0800
commitb3d6306759e450a5d004b6581e0bf3b891b93fa5 (patch)
tree8b076b9d8c54ca6e0827dc1874403724b1633f06 /Test
parent62f42e257fd72498e692c7ce8aaee339ad5322e6 (diff)
Fix issue 138. Allow parenthese with the nullary constructor in
"case" of a match statement and match expression.
Diffstat (limited to 'Test')
-rw-r--r--Test/dafny4/Bug138.dfy22
-rw-r--r--Test/dafny4/Bug138.dfy.expect2
2 files changed, 24 insertions, 0 deletions
diff --git a/Test/dafny4/Bug138.dfy b/Test/dafny4/Bug138.dfy
new file mode 100644
index 00000000..db0e54ef
--- /dev/null
+++ b/Test/dafny4/Bug138.dfy
@@ -0,0 +1,22 @@
+// RUN: %dafny /compile:0 "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+datatype List = Nil | Cons(int, List)
+
+method R(xs: List)
+{
+ match xs
+ case Nil() => // currently produces a parsing error, but shouldn't
+ case Cons(x, Nil()) => // currently allowed
+ case Cons(x, Cons(y, tail)) =>
+}
+
+function F(xs: List) : int
+{
+ match xs
+ case Nil() => 0 // currently produces a parsing error, but shouldn't
+ case Cons(x, Nil()) => 1 // currently allowed
+ case Cons(x, Cons(y, tail)) => 2
+}
+
+
diff --git a/Test/dafny4/Bug138.dfy.expect b/Test/dafny4/Bug138.dfy.expect
new file mode 100644
index 00000000..52595bf9
--- /dev/null
+++ b/Test/dafny4/Bug138.dfy.expect
@@ -0,0 +1,2 @@
+
+Dafny program verifier finished with 3 verified, 0 errors