summaryrefslogtreecommitdiff
path: root/Test/dafny0/OpaqueFunctions.dfy
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2013-12-17 13:56:41 -0800
committerGravatar Rustan Leino <unknown>2013-12-17 13:56:41 -0800
commit679af7cd0963341cbb057cf9049c81b515a8fa26 (patch)
treefc796b17831d924689c491583c0efd9203edad77 /Test/dafny0/OpaqueFunctions.dfy
parentbbf809e2a1a474e6e79b1c02faa42ec22af8ac8c (diff)
Don't inline opaque functions.
Added a verifying example with opaque functions and explicit proofs.
Diffstat (limited to 'Test/dafny0/OpaqueFunctions.dfy')
-rw-r--r--Test/dafny0/OpaqueFunctions.dfy21
1 files changed, 21 insertions, 0 deletions
diff --git a/Test/dafny0/OpaqueFunctions.dfy b/Test/dafny0/OpaqueFunctions.dfy
index c15515d2..9879c66b 100644
--- a/Test/dafny0/OpaqueFunctions.dfy
+++ b/Test/dafny0/OpaqueFunctions.dfy
@@ -121,3 +121,24 @@ module B' refines B {
}
}
+// ---------------------------------
+
+module OpaqueFunctionsAreNotInlined {
+ predicate {:opaque} F(n: int)
+ {
+ 0 <= n < 100
+ }
+
+ method M()
+ {
+ var x := 18;
+ assert F(x); // error: cannot be determined, since F is opaque
+ }
+
+ method M'()
+ {
+ var x := 18;
+ reveal_F();
+ assert F(x);
+ }
+}