-
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
Properly check if types may contain references #1924
Conversation
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.
For datatypes, why is it enough to check just the type parameters? The following looks off to me:
class C {}
datatype D = DC(c: C)
type X(!new) = D // No error
datatype Obs' = Obs'(s: set<object>)
predicate lotsOfObjects'() {
exists o: Obs' :: |o.s| > 10 // No error
}
And also this:
class C {}
datatype Box<T> = Box(t: T)
type Box'(!new) = Box<C> // Rejected
datatype BoxC = BoxC(c: C)
type BoxC'(!new) = BoxC // No error
Am I missing something?
@cpitclaudel Thank you. These are (still) bugs. |
Do we adress them in the same PR, or merge this one and open a separate ticket for the next? |
The Schorr-Waite test programs are not allowed by the new rules. To sort this out, Dafny needs a more flexible mechanism to indicate that quantifiers only quantify over allocated state. I will add this mechanism in a separate PR and then return to this one.
@cpitclaudel I addressed the further issues in this PR with the commit I just pushed. However, the fix causes errors that the old Schorr-Waite test programs have a function that depends on the allocation state. To sort this out, Dafny needs a more flexible mechanism to indicate that quantifiers only quantify over allocated state. I will add this mechanism in a separate PR and then return to this one. |
These `:older` attributes on `ReachableVia` will once again allow the `SchorrWaite*.dfy` tests, as soon as dafny-lang#1936 is merged.
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.
Very nice, thanks!
# Conflicts: # RELEASE_NOTES.md
# Conflicts: # RELEASE_NOTES.md # Source/Dafny/Resolver.cs
The new check is correct, but this is not fully satisfactory, as it removes a useful debugging aid. Ideally, it would be nice to be able to mark these extern classes as frozen, so that they might be treated as `!new`.
The new check is correct, but this is not fully satisfactory, as it removes a useful debugging aid. Ideally, it would be nice to be able to mark these extern classes as frozen, so that they might be treated as `!new`.
The new check is correct, but this is not fully satisfactory, as it removes a useful debugging aid. Ideally, it would be nice to be able to mark these extern classes as frozen, so that they might be treated as `!new`.
Previously, types were not properly checked for whether or not they may contain references. This PR fixes that.
Fixes #1419
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.