-
Notifications
You must be signed in to change notification settings - Fork 267
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
Allow revealing using a static receiver #5760
Merged
keyboardDrummer
merged 7 commits into
dafny-lang:master
from
keyboardDrummer:staticReveal
Sep 10, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c4b36de
Add test that checks whether we can use static qualification to revea…
keyboardDrummer ab77060
Add extra testcase
keyboardDrummer 6bdc80b
Allow revealing static expression
keyboardDrummer 6790c48
Add release note
keyboardDrummer c279b31
Update test expect file
keyboardDrummer 0acf1a3
Merge branch 'master' into staticReveal
keyboardDrummer 6e73a83
Update docs/dev/news/5760.fix
keyboardDrummer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
39 changes: 39 additions & 0 deletions
39
Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealQualified.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,39 @@ | ||
// RUN: %resolve --type-system-refresh --allow-axioms %s > %t | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
module Prod { | ||
class Foo { | ||
function P(x: int): bool { | ||
true | ||
} | ||
|
||
static function Q(x: int): bool { | ||
true | ||
} | ||
} | ||
|
||
method StaticRevealWorks() { | ||
hide *; | ||
|
||
reveal Foo.P; | ||
reveal Foo.Q; | ||
} | ||
|
||
method InstanceRevealWorks(foo: Foo) { | ||
hide *; | ||
|
||
reveal foo.P; | ||
reveal foo.Q; | ||
} | ||
} | ||
|
||
module Cons { | ||
import Prod | ||
|
||
method StaticRevealWorks() { | ||
hide *; | ||
|
||
reveal Prod.Foo.P; | ||
reveal Prod.Foo.Q; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealQualified.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,2 @@ | ||
|
||
Dafny program verifier did not attempt verification |
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
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 @@ | ||
The new resolver (accessible using `--type-system-refresh`) can now handle revealing instance functions using a static receiver, as it is the case for the current resolver |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These boolean flags are hard to review on GitHub, Non blocking for this one, but I would encourage in the future that we switch to enums when it's not obvious what a boolean is about. For example,
StaticReferenceToInstance.Allowed
.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.
I'm a bit conflicted on this. There's also a third option of adding the argument name, so it would say
allowStaticReferenceToInstance: true
. Possibly you could configure a linter to always require the argument name for booleans.