summaryrefslogtreecommitdiff
path: root/Test/dafny0/TypeTests.dfy
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-10-28 23:19:34 -0700
committerGravatar leino <unknown>2014-10-28 23:19:34 -0700
commit8a1cd890191d8e92f0d478445740d9ee24086429 (patch)
treedb0485918f9ab530c5b356f4a85e4c18e79393fb /Test/dafny0/TypeTests.dfy
parent655b8311917e38cc2b359bad46def21de7852508 (diff)
Fixed type-inference bug that could create cycles in proxy type graph
Diffstat (limited to 'Test/dafny0/TypeTests.dfy')
-rw-r--r--Test/dafny0/TypeTests.dfy25
1 files changed, 25 insertions, 0 deletions
diff --git a/Test/dafny0/TypeTests.dfy b/Test/dafny0/TypeTests.dfy
index 6086fcf1..141e48cb 100644
--- a/Test/dafny0/TypeTests.dfy
+++ b/Test/dafny0/TypeTests.dfy
@@ -144,3 +144,28 @@ ghost method GhostM() returns (x: int)
{
x :| true; // no problem (but there once was a problem with this case, where an error was generated for no reason)
}
+
+// ------------------ cycles that could arise from proxy assignments ---------
+
+module ProxyCycles {
+ datatype Dt<X> = Ctor(X -> Dt<X>)
+ method M0()
+ {
+ var dt: Dt<int>;
+ var f := x => x;
+ dt := Ctor(f); // error: cannot infer a type for f
+ }
+ method M1()
+ {
+ var dt: Dt;
+ var f := x => x;
+ dt := Ctor(f); // error: cannot infer a type for f
+ }
+
+ function method F<X>(x: X): set<X>
+ method N()
+ {
+ var x;
+ x := F(x); // error: cannot infer type for x
+ }
+}