diff options
author | Rustan Leino <leino@microsoft.com> | 2012-01-26 13:05:50 -0800 |
---|---|---|
committer | Rustan Leino <leino@microsoft.com> | 2012-01-26 13:05:50 -0800 |
commit | 4888eb23bb6ccd0900915ee00d9fcbc25c2f21e1 (patch) | |
tree | cea1ae346321712532a8ff68c6b7765ffa6eb894 | |
parent | 84044e50d78c3fb1bddb6a72ab39bce7cc6caa55 (diff) |
Dafny: fixed bug in compilation of let expressions.
-rw-r--r-- | Dafny/Compiler.cs | 11 | ||||
-rw-r--r-- | Test/dafny1/Rippling.dfy | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Dafny/Compiler.cs b/Dafny/Compiler.cs index 4a2b41a1..caf3df24 100644 --- a/Dafny/Compiler.cs +++ b/Dafny/Compiler.cs @@ -545,16 +545,17 @@ namespace Microsoft.Dafny { Contract.Requires(0 <= indent);
if (expr == null) {
// allow "null" as an argument; nothing to do
- } else if (expr is LetExpr) {
+ return;
+ }
+ if (expr is LetExpr) {
var e = (LetExpr)expr;
foreach (var v in e.Vars) {
Indent(indent);
wr.WriteLine("{0} @{1};", TypeName(v.Type), v.Name);
}
- } else {
- foreach (var ee in expr.SubExpressions) {
- SpillLetVariableDecls(ee, indent);
- }
+ }
+ foreach (var ee in expr.SubExpressions) {
+ SpillLetVariableDecls(ee, indent);
}
}
diff --git a/Test/dafny1/Rippling.dfy b/Test/dafny1/Rippling.dfy index 677e6e70..8bed7545 100644 --- a/Test/dafny1/Rippling.dfy +++ b/Test/dafny1/Rippling.dfy @@ -303,7 +303,7 @@ ghost method P1() }
ghost method P2()
- ensures forall n, xs, ys :: add(count(n, xs), count(n, ys)) == count(n, (concat(xs, ys)));
+ ensures forall n, xs, ys :: add(count(n, xs), count(n, ys)) == count(n, concat(xs, ys));
{
}
|