diff options
-rw-r--r-- | Dafny/Translator.cs | 2 | ||||
-rw-r--r-- | Test/dafny0/Answer | 5 | ||||
-rw-r--r-- | Test/dafny0/SmallTests.dfy | 10 |
3 files changed, 15 insertions, 2 deletions
diff --git a/Dafny/Translator.cs b/Dafny/Translator.cs index ce64e202..85c15f5a 100644 --- a/Dafny/Translator.cs +++ b/Dafny/Translator.cs @@ -6483,7 +6483,7 @@ namespace Microsoft.Dafny { var ssThen = new List<SplitExprInfo>();
var ssElse = new List<SplitExprInfo>();
// Note: The following lines intentionally uses | instead of ||, because we need both calls to TrSplitExpr
- if (TrSplitExpr(ite.Thn, ssThen, position, expandFunctions, etran) | TrSplitExpr(ite.Thn, ssElse, position, expandFunctions, etran)) {
+ if (TrSplitExpr(ite.Thn, ssThen, position, expandFunctions, etran) | TrSplitExpr(ite.Els, ssElse, position, expandFunctions, etran)) {
var op = position ? BinaryOperator.Opcode.Imp : BinaryOperator.Opcode.And;
var test = etran.TrExpr(ite.Test);
foreach (var s in ssThen) {
diff --git a/Test/dafny0/Answer b/Test/dafny0/Answer index 1eb22708..8287c38b 100644 --- a/Test/dafny0/Answer +++ b/Test/dafny0/Answer @@ -243,8 +243,11 @@ Execution trace: SmallTests.dfy(364,4): Error: cannot prove termination; try supplying a decreases clause
Execution trace:
(0,0): anon3_Else
+SmallTests.dfy(411,41): Error: possible violation of function postcondition
+Execution trace:
+ (0,0): anon6_Else
-Dafny program verifier finished with 47 verified, 20 errors
+Dafny program verifier finished with 47 verified, 21 errors
-------------------- Definedness.dfy --------------------
Definedness.dfy(8,7): Error: possible division by zero
diff --git a/Test/dafny0/SmallTests.dfy b/Test/dafny0/SmallTests.dfy index 2074e484..041b51c1 100644 --- a/Test/dafny0/SmallTests.dfy +++ b/Test/dafny0/SmallTests.dfy @@ -402,3 +402,13 @@ class Test { }
}
+
+// ------ an if-then-else regression test
+
+function F(b: bool): int
+ // The if-then-else in the following line was once translated incorrectly,
+ // incorrectly causing the postcondition to verify
+ ensures if b then F(b) == 5 else F(b) == 6;
+{
+ 5
+}
|