Skip to content
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 static reveal of instance function in new resolver #4733

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

RustanLeino
Copy link
Collaborator

PR #4180 introduced the ability to reveal an instance function in a static context. In the recent PR #4498, this has been implemented to put the instance function itself, without a receiver argument, into an attribute. The recent PR then special-cases the resolution of that attribute. I would call that a hack.

This PR mimics that hack for the new resolver. That makes git-issue-4315.dfy (see Issue #4315) pass with both resolvers.

The hack introduced in this PR and in #4498 is not a great idea, because a use of this is placed into the AST in a context where there is no this. If (rather, when) this gets fixed, it should be fixed in both resolvers.

How has this been tested?

Test git-issues/git-issue-4315.dfy has been converted to run with both the old and new resolver.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

RustanLeino added a commit to RustanLeino/dafny that referenced this pull request Nov 1, 2023
…er does"

This reverts commit 483af6c.

This change has been moved to a separate PR: dafny-lang#4733
MikaelMayer
MikaelMayer previously approved these changes Nov 2, 2023
Copy link
Member

@MikaelMayer MikaelMayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate indeed, but it's the way the translator worked that made this change the most straightforward. The translator does not care about the "this" part, only the member and function, so "this.f" serves only as a pointer to the function. I'm not sure how we could store a pointer to a non-static function in a resolved expression otherwise.

Good job for making the new resolver up to date with that change.

If appropriate, can you please add an entry like doc/dev/4733.fix containing something like "The new type checker now also supports static reveals for instance functions" ?

@RustanLeino RustanLeino merged commit 2d26031 into dafny-lang:master Nov 2, 2023
20 checks passed
@RustanLeino RustanLeino deleted the re-issue-4315 branch November 2, 2023 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants