-
Notifications
You must be signed in to change notification settings - Fork 261
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: Check for correct use of type characteristics in ghosts and default expressions #4928
Conversation
…ault expressions Fixes dafny-lang#4926
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring as well ! Note it's easier to review if you put the code move into a separate commit.
# Conflicts: # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-cs.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-go.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-java.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-js.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-notarget.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-py.doo # Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries.doo # Source/DafnyStandardLibraries/src/Std/Collections/Seq.dfy
@@ -0,0 +1 @@ | |||
Check for correct usage of type characteristics in specifications and other places where they were missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly then this PR is a breaking change: it will cause Dafny to error in some locations where it previously did not. For example you had to update Source/DafnyStandardLibraries/src/Std/Collections/Array.dfy
Might be good to note that in the release notes.
Embellish release notes of PR #4928. The release note now try to make it clear that any new errors (for this issue) on previous programs are intentional. <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>
This PR adds checks for correct instantiations of type parameters that were previously missing. Previously, these checks were only done in non-ghost expressions (historically, it seems the code that performs these checks was designed for checking
(==)
, which applies only in ghost expressions). This PR adds the checks also specifications (which are ghost) and default expressions for parameters).The new test file
git-issue-4926.dfy
reports 38 errors, whereas before this PR, Dafny reported only 8.It also extracts the code for these checks into a separate file,
TypeCharacteristicChecker.cs
(in addition to the existing fileCheckTypeCharacteristics_Visitor
).Fixes #4926
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.