diff --git a/Source/DafnyCore/Dafny.atg b/Source/DafnyCore/Dafny.atg index 0a5751d168..2f45f035fd 100644 --- a/Source/DafnyCore/Dafny.atg +++ b/Source/DafnyCore/Dafny.atg @@ -2391,19 +2391,16 @@ AssignStatement s = new AssignSuchThatStmt(rangeToken, lhss, suchThat, suchThatAssume, null); } else if (exceptionRhs != null) { s = new AssignOrReturnStmt(rangeToken, lhss, exceptionRhs, keywordToken, rhss); - if (proof != null) { - s = new BlockByProofStmt(rangeToken, proof, s); - } } else { if (lhss.Count == 0 && rhss.Count == 0) { s = new BlockStmt(rangeToken, new List()); // error, give empty statement } else { s = new AssignStatement(rangeToken, lhss, rhss); - if (proof != null) { - s = new BlockByProofStmt(rangeToken, proof, s); - } } } + if (proof != null) { + s = new BlockByProofStmt(rangeToken, proof, s); + } .) . diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy index 43edfe82cb..109a9cb3b3 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy @@ -5,4 +5,12 @@ method ByClause(b: bool) { var r: int :| false by { assume {:axiom} false; } +} + +function F(x: int): int +method ByClauseSeparateAssignment() { + var a; + a :| F(a) == 2 by { + assume {:axiom} F(10) == 2; + } } \ No newline at end of file diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy.expect b/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy.expect index 823a60a105..ebe2328e07 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy.expect +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy.expect @@ -1,2 +1,2 @@ -Dafny program verifier finished with 1 verified, 0 errors +Dafny program verifier finished with 2 verified, 0 errors diff --git a/docs/dev/news/6024.fix b/docs/dev/news/6024.fix new file mode 100644 index 0000000000..d8b3b8868e --- /dev/null +++ b/docs/dev/news/6024.fix @@ -0,0 +1 @@ +By clauses for assign-such-that statements (:|), are now never ignored. \ No newline at end of file