Closed RustanLeino closed 10 months ago
Note, this libraries
repository was recently deprecated (https://github.com/dafny-lang/libraries/pull/155). Still, I think it makes sense to roll in this PR, since it contains valid changes and is otherwise ready to go.
This PR primarily adds missing
(!new)
type characteristics in function declarations. These had gone undetected, because of a latent bug that has now been fixed. The bug fix requires these fixes in the libraries.This PR also cleans up some library files: removing deprecated semi-colons, removing unnecessary parentheses, stylizing order of specification clauses, and removing explicit triggers that are saying the same thing as those triggers that are automatically inferred.
The PR also changesforall ensures ...
statements with no bound variables intoassert ... by
statements. (I think we attempted this change once before, only to find that the change tickled some brittleness issue. Let's see if they verify this time.)Finally, the PR improves some
reads fn
clauses, wherefn
is some function. In one case, such areads
clause was probably accidentally (and I changed it to the more specificreads fn(this)
). In the other cases, thereads fn
clause had ended up reading more than the enclosing function's precondition could support. The newreads
clauses are more specific than the previous, so, semantically, they should not affect callers. I'm surprised how these were not detected before (am I perhaps running the wrong version of Dafny when running thelibraries
test suite?). In fact, I also received an error, which I think is due to that a previous version of Dafny didn't assumerequires
clauses when checkingreads
clauses in lambda expressions (or was it perhaps the other way around?). If there's still a problem with my modifications, I hope CI will discover them.Hint to reviewers: If you want to see each of the simple modifications, I suggest looking at each commit individually.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.