summaryrefslogtreecommitdiff
path: root/Test/linear/typecheck.bpl
diff options
context:
space:
mode:
authorGravatar Unknown <qadeer@FAIZ-AHMED-FAIZ.redmond.corp.microsoft.com>2013-02-13 13:19:38 -0800
committerGravatar Unknown <qadeer@FAIZ-AHMED-FAIZ.redmond.corp.microsoft.com>2013-02-13 13:19:38 -0800
commit6204a4510168dbcd95a0e9e0ec255fb58bb44d87 (patch)
tree57a538891cb769aa6771f16f37a918d5ac03aced /Test/linear/typecheck.bpl
parent1ca4bdc8652046f902b50820c1c250148e1abe25 (diff)
fixed bugs in typechecking of linear sets
added regressions to linear sets removed the need to supply the builtin map operations manually
Diffstat (limited to 'Test/linear/typecheck.bpl')
-rw-r--r--Test/linear/typecheck.bpl65
1 files changed, 65 insertions, 0 deletions
diff --git a/Test/linear/typecheck.bpl b/Test/linear/typecheck.bpl
new file mode 100644
index 00000000..f79f8fb5
--- /dev/null
+++ b/Test/linear/typecheck.bpl
@@ -0,0 +1,65 @@
+type X;
+
+procedure A()
+{
+ var {:linear "A"} a: X;
+ var {:linear "A"} b: int;
+}
+
+procedure B()
+{
+ var {:linear "B"} a: X;
+ var {:linear "B"} b: [X]bool;
+}
+
+procedure C()
+{
+ var {:linear "C"} a: X;
+ var {:linear "C"} c: [X]int;
+}
+
+function f(X): X;
+
+procedure D()
+{
+ var {:linear "D"} a: X;
+ var {:linear "D"} x: X;
+ var {:linear "D"} b: [X]bool;
+ var c: X;
+ var {:linear "D2"} d: X;
+
+ b[a] := true;
+
+ a := f(a);
+
+ a := c;
+
+ c := a;
+
+ a := d;
+
+ a := a;
+
+ a, x := x, a;
+
+ a, x := x, x;
+
+ call a, x := E(a, x);
+
+ call a, x := E(a, a);
+
+ call a, x := E(a, f(a));
+
+ call a, x := E(a, d);
+
+ call d, x := E(a, x);
+
+ call a, x := E(c, x);
+
+ call c, x := E(a, x);
+}
+
+procedure E({:linear "D"} a: X, {:linear "D"} b: X) returns ({:linear "D"} c: X, {:linear "D"} d: X)
+{
+ c := a;
+} \ No newline at end of file