Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Missing token in translation of proper prefix #2652

Merged
merged 2 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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