diff options
author | qunyanm <unknown> | 2016-01-07 16:43:53 -0800 |
---|---|---|
committer | qunyanm <unknown> | 2016-01-07 16:43:53 -0800 |
commit | 4c4647bbd61883edee6f55d5dc37c9649d23af2e (patch) | |
tree | 1c974221f03b66b865d41987175b5062254e7426 | |
parent | 4c81e90e18b1d142c50453470fe9647693ef8de4 (diff) |
Fix issue 118. When iteratively computing bounds, treat RefBoundedPool typed
bound as undetermined so that iteration will continue.
-rw-r--r-- | Source/Dafny/Resolver.cs | 5 | ||||
-rw-r--r-- | Test/dafny4/Bug118.dfy | 12 | ||||
-rw-r--r-- | Test/dafny4/Bug118.dfy.expect | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/Source/Dafny/Resolver.cs b/Source/Dafny/Resolver.cs index 9dc0f829..79f1e7e1 100644 --- a/Source/Dafny/Resolver.cs +++ b/Source/Dafny/Resolver.cs @@ -9771,11 +9771,14 @@ namespace Microsoft.Dafny bests = all.ConvertAll(tup => ComprehensionExpr.BoundedPool.GetBest(tup.Item2, onlyFiniteBounds));
// check to see if we found new bounds in this iteration
int count = 0;
+ // figure out how many bounds are not determined yet.
for (int i = 0; i < bests.Count; i++) {
- if (bests[i] == null) {
+ if (bests[i] == null || (bests[i] is ComprehensionExpr.RefBoundedPool)) {
count++;
}
}
+ // if there are bounds that are not determined yet and the number of undetermined bounds
+ // changed, we will need to do another iteration.
if (count >0 && count != orgCount) {
changed = true;
knownBounds = bests;
diff --git a/Test/dafny4/Bug118.dfy b/Test/dafny4/Bug118.dfy new file mode 100644 index 00000000..1e2dddeb --- /dev/null +++ b/Test/dafny4/Bug118.dfy @@ -0,0 +1,12 @@ +// RUN: %dafny /compile:0 "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+class Foo {
+ ghost var Repr: set<object>
+}
+
+function SeqRepr(s:seq<Foo>) : set<object>
+ reads set b | b in s
+{
+ set o,b | b in s && b != null && o in b.Repr :: o // Works if you say "set b,o | ..."
+}
\ No newline at end of file diff --git a/Test/dafny4/Bug118.dfy.expect b/Test/dafny4/Bug118.dfy.expect new file mode 100644 index 00000000..c0c48e2b --- /dev/null +++ b/Test/dafny4/Bug118.dfy.expect @@ -0,0 +1,2 @@ +
+Dafny program verifier finished with 1 verified, 0 errors
|