summaryrefslogtreecommitdiff
path: root/Test/dafny0/Array.dfy
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2014-03-20 15:01:57 -0700
committerGravatar Rustan Leino <unknown>2014-03-20 15:01:57 -0700
commit912adaa06621d89a47460d6a6befd8809ded5c85 (patch)
tree1016a8998a8fd80042aaf36997e98bbfb5f9c236 /Test/dafny0/Array.dfy
parent73d20fd1f40d380f10a4a62cb8853137e340514a (diff)
Fixed problem with propagating allocation information about array elements.
Improved situation with (reducing bogosity of) type checking of "object".
Diffstat (limited to 'Test/dafny0/Array.dfy')
-rw-r--r--Test/dafny0/Array.dfy21
1 files changed, 21 insertions, 0 deletions
diff --git a/Test/dafny0/Array.dfy b/Test/dafny0/Array.dfy
index d8bffce4..4cd06e53 100644
--- a/Test/dafny0/Array.dfy
+++ b/Test/dafny0/Array.dfy
@@ -253,3 +253,24 @@ method Test_ArrayElementLhsOfCall(a: array<int>, i: int, c: Cdefg<int>) returns
class Cdefg<T> {
var t: T;
}
+
+// ---------- allocation business -----------
+
+class MyClass {
+ ghost var Repr: set<object>;
+}
+
+method AllocationBusinessA(a: array<MyClass>, j: int)
+ requires a != null && 0 <= j < a.Length;
+ requires a[j] != null;
+{
+ var c := new MyClass;
+ assert c !in a[j].Repr; // the proof requires allocation axioms for arrays
+}
+method AllocationBusinessB(a: array2<MyClass>, i: int, j: int)
+ requires a != null && 0 <= i < a.Length0 && 0 <= j < a.Length1;
+ requires a[i,j] != null;
+{
+ var c := new MyClass;
+ assert c !in a[i,j].Repr; // the proof requires allocation axioms for multi-dim arrays
+}