summaryrefslogtreecommitdiff
path: root/Test/dafny0/AutoReq.dfy
diff options
context:
space:
mode:
authorGravatar Bryan Parno <parno@microsoft.com>2014-01-08 12:54:11 -0800
committerGravatar Bryan Parno <parno@microsoft.com>2014-01-08 12:54:11 -0800
commit2dab50557b2584a82ffc7be8759d6a8a4720d1f9 (patch)
tree90032dae0fc63feb8706519e6dd918441163eed0 /Test/dafny0/AutoReq.dfy
parentd6f192b7bb331d42a0a4dcd6ab125857a431ac67 (diff)
Add autoReq support for matches.
Add better handling of resolved data types in autoReq.
Diffstat (limited to 'Test/dafny0/AutoReq.dfy')
-rw-r--r--Test/dafny0/AutoReq.dfy32
1 files changed, 30 insertions, 2 deletions
diff --git a/Test/dafny0/AutoReq.dfy b/Test/dafny0/AutoReq.dfy
index 9e221900..00c74f50 100644
--- a/Test/dafny0/AutoReq.dfy
+++ b/Test/dafny0/AutoReq.dfy
@@ -222,7 +222,36 @@ module {:autoReq} M1 {
}
}
-/* Not yet implemented
+module Datatypes {
+ datatype TheType = TheType_builder(x:int) | TheType_copier(t:TheType);
+
+ function f1(t:TheType):bool
+ requires t.TheType_builder? && t.x > 3;
+
+ function {:autoReq} test(t:TheType) : bool
+ {
+ f1(t)
+ }
+
+ function f2(x:int) : bool
+ requires forall t:TheType :: t.TheType_builder? && t.x > x;
+ {
+ true
+ }
+
+ // Should cause a function-requirement violation without autoReq
+ function f3(y:int) : bool
+ {
+ f2(y)
+ }
+
+ function {:autoReq} test2(z:int) : bool
+ {
+ f2(z)
+ }
+
+}
+
module Matches {
datatype TheType = TheType_builder(x:int) | TheType_copier(t:TheType);
@@ -236,6 +265,5 @@ module Matches {
case TheType_copier(t) => true
}
}
-*/