-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description This PR updates the Dafny CS runtime to use BigIntegers instead of int32 when retrieving the number of elements in a multiset. As this number may be over INT_MAX, this change avoids potential overflows. This is similar to what is done in the Java runtime. ### How has this been tested? A test was added: Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5554.dfy <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
- Loading branch information
1 parent
940ccf6
commit 7415591
Showing
3 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5554.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %dafny -compile:4 -compileTarget:cs "%s" | ||
|
||
datatype MultisetContainer = EmptySet | BooleanMultiset(containerSet: multiset<bool>) | ||
|
||
method Main() { | ||
var initialMultiset := multiset{false}; | ||
|
||
for iteration := 0 to 31 { | ||
var multisetInstance := BooleanMultiset(initialMultiset); | ||
initialMultiset := initialMultiset + multisetInstance.containerSet; | ||
} | ||
print initialMultiset > initialMultiset; | ||
} |
1 change: 1 addition & 0 deletions
1
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5554.dfy.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
false |