-
Notifications
You must be signed in to change notification settings - Fork 32
Move All Resolution to the Resolution Stage #297
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
Move All Resolution to the Resolution Stage #297
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
291be61
to
48d1f31
Compare
44d860a
to
ebe2b51
Compare
7bf2ceb
to
424b104
Compare
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
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.
LGTM
0062994
to
3c41858
Compare
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.
Nice work! I did not yet have time to review the whole diff, but here are preliminary comments.
case _ => N | ||
|
||
def withIArgs(iargsLs: Ls[Term.Tup]): Term = | ||
this.iargsLs = S(iargsLs) |
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.
this.iargsLs = S(iargsLs) | |
require(this.iargsLs.isEmpty) | |
this.iargsLs = S(iargsLs) |
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 just realized that there is probably a hole in the implementation... In the codebase, there are some places (mostly UCS normalization) that use the same term in different places as if they were immutable. So we couldn't simply apply this change. We may need a proper duplication mechanism to resolve this problem.
A more problematic thing is that the implicit arguments of a term might be resolved differently if the same term was used in different places... I changed the condition to this.iargsLs.isEmpty || this.iargsLs.get == iargsLs
and fortunately it doesn't report any problem.
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.
Good catch. But I think this will be fine once the UCS normalization is moved to/after the resolution phase: we will probably not even need to duplicate the terms, which will be already resolved.
Cc @chengluyu
mostly UCS normalization
Are there any other places where this happens?
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.
Yes, a few places in the elaborator. I remember it is somewhere in elaborating SynthSel
.
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
case _ => N | ||
|
||
def withIArgs(iargsLs: Ls[Term.Tup]): Term = | ||
this.iargsLs = S(iargsLs) |
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.
Good catch. But I think this will be fine once the UCS normalization is moved to/after the resolution phase: we will probably not even need to duplicate the terms, which will be already resolved.
Cc @chengluyu
mostly UCS normalization
Are there any other places where this happens?
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
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 another great contribution!
This PR is based on #295 so that there are some duplicated commits. I will fix them once #295 is merged.
It moves the whole implicit arguments resolution to the resolution stage, supporting forward type classes usage.
The features in this PR are complete but there may have some styling or designing issues that require refactorization.