Skip to content

Commit

Permalink
fix: Missing token in translation of proper prefix (#2652)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelMayer authored Aug 30, 2022
1 parent ac8c07c commit 845e71f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- feat: Support for the `{:opaque}` attibute on `const` (https://github.com/dafny-lang/dafny/pull/2545)
- feat: Support for plugin-based code actions on the IDE (https://github.com/dafny-lang/dafny/pull/2021)
- fix: Added missing error reporting position on string prefix check (https://github.com/dafny-lang/dafny/pull/2652)
- fix: Check all compiled expressions to be compilable (https://github.com/dafny-lang/dafny/pull/2641)


Expand Down
4 changes: 3 additions & 1 deletion Source/Dafny/Verifier/Translator.BoogieFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,11 @@ public Bpl.Expr ProperPrefix(Bpl.IToken tok, Bpl.Expr e0, Bpl.Expr e1) {
Contract.Ensures(Contract.Result<Bpl.Expr>() != null);
Bpl.Expr len0 = FunctionCall(tok, BuiltinFunction.SeqLength, null, e0);
Bpl.Expr len1 = FunctionCall(tok, BuiltinFunction.SeqLength, null, e1);
return Bpl.Expr.And(
var result = Bpl.Expr.And(
Bpl.Expr.Lt(len0, len1),
FunctionCall(tok, BuiltinFunction.SeqSameUntil, null, e0, e1, len0));
result.tok = tok;
return result;
}

Bpl.Expr ArrayLength(Bpl.IToken tok, Bpl.Expr arr, int totalDims, int dim) {
Expand Down
8 changes: 8 additions & 0 deletions Test/git-issues/git-issue-2651.dfy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %dafny_0 /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

method z(x: string, y: string) {
var a: string := "abc";
var b: string := x + y;
assert a <= x ==> a < b; // SHOULD FAIL
}
3 changes: 3 additions & 0 deletions Test/git-issues/git-issue-2651.dfy.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git-issue-2651.dfy(7,22): Error: assertion might not hold

Dafny program verifier finished with 0 verified, 1 error

0 comments on commit 845e71f

Please sign in to comment.