-
Notifications
You must be signed in to change notification settings - Fork 285
Class Invariants: Resolution and Wellformedness #6255
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
Conversation
TODO: source under SyntaxDeserializer needs to be properly regenerated TODO: tests for parsing and resolving need to be completed
…into feat-invariants
If the purpose of this is just to disallow certain fields from being mentioned, then I suggest doing this in a resolver pass after |
|
Oh I see, is it fragile because either the inherited fields of a class are not fully resolved or the field reference in question is not by the time the check is made in |
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.
Exciting! Mostly reviewed at a high level, will look closer at implementation in the next round.
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/Expressivity.dfy
Outdated
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/ReadsError.dfy
Outdated
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/Baseline.dfy
Show resolved
Hide resolved
Source/DafnyCore/Resolver/PreType/PreTypeResolve.Expressions.cs
Outdated
Show resolved
Hide resolved
Source/DafnyCore/Resolver/PreType/PreTypeResolve.Expressions.cs
Outdated
Show resolved
Hide resolved
…Expressivity.dfy Co-authored-by: Robin Salkeld <[email protected]>
Co-authored-by: Robin Salkeld <[email protected]>
…dingly - Wellformedness checks simplified, since they do not have to be scoped to an enclosing declaration - VerifyInvariants renamed to CheckInvariants and is automatically checked when a MemberDecl is coerced to an Invariant - Refinement is now implemented, solving issue in InheritedMemberError.dfy - Printing now implemented
…om invariants to be done as a visitor-based check
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 moving the resolution checks out of "pass 0". Thanks also for taking refinement modules into considerations (that's easy to forget).
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/Counter.dfy
Outdated
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/ReadsError.dfy.expect
Outdated
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/InheritedMemberError.dfy.expect
Outdated
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/Expressivity.dfy
Show resolved
Hide resolved
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/InheritedMemberError.dfy
Show resolved
Hide resolved
…f rewriting and axioms
…on, keeping invariant-as-predicate
|
Closing in favor of #6313 |
What was changed?
Invariantis aMemberDeclthat holds all of the invariant clauses of an enclosing class (could be any type, but the wellformedness checks currently only make sense for classes). There is not yet a correspondingMemberSelectExpr(in fact, it won't even parse).InvariantChecker)BoogieGeneratormodified to add well-formedness checks for classes, largely copied from function well-formedness checks. A collection of invariants for a class induces the usual expression well-formedness checks + a check that they only readthis--check-invariantsis enabled (used to be--verify-invariants).I want explicit feedback on any comments marked
TODO(usually text of error messages).How has this been tested?
Tests under
Source/IntegrationTests/TestFiles/LitTests/LitTest/invariants/.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.