summaryrefslogtreecommitdiff
path: root/Source/Dafny/Printer.cs
diff options
context:
space:
mode:
authorGravatar wuestholz <unknown>2011-12-26 22:18:21 +0100
committerGravatar wuestholz <unknown>2011-12-26 22:18:21 +0100
commit38c3d80bbe57fe792c400908b0afacda5d8eecf7 (patch)
tree9d466918ab0bf5d8c15850275f961ad6dcab862f /Source/Dafny/Printer.cs
parent66bf828bf85324052fce705c2f850d73eb989994 (diff)
Dafny: Fixed a bug in the pretty printer.
Diffstat (limited to 'Source/Dafny/Printer.cs')
-rw-r--r--Source/Dafny/Printer.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/Dafny/Printer.cs b/Source/Dafny/Printer.cs
index cf8be27e..4290953b 100644
--- a/Source/Dafny/Printer.cs
+++ b/Source/Dafny/Printer.cs
@@ -976,9 +976,13 @@ namespace Microsoft.Dafny {
bool parensNeeded = opBindingStrength < contextBindingStrength ||
(fragileContext && opBindingStrength == contextBindingStrength);
+ bool containsNestedNot = e.E is ParensExpression &&
+ ((ParensExpression)e.E).E is UnaryExpr &&
+ ((UnaryExpr)((ParensExpression)e.E).E).Op == UnaryExpr.Opcode.Not;
+
if (parensNeeded) { wr.Write("("); }
wr.Write(op);
- PrintExpr(e.E, opBindingStrength, false, parensNeeded || isRightmost, -1);
+ PrintExpr(e.E, opBindingStrength, containsNestedNot, parensNeeded || isRightmost, -1);
if (parensNeeded) { wr.Write(")"); }
}