-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Matching redeclarations #3763
Matching redeclarations #3763
Conversation
9df4a27
to
ef12d93
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.
I had a couple questions about extern
handling as mentioned here. I skimmed through everything else and 👍
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.
Largely looks good. Mostly cosmetic comments on my end except for the thunk part for impl
functions. But even that is really just trying to find a somewhat cleaner model, not suggesting shifting direction.
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.
Sorry this somewhat fell off my radar, I think there's mostly just a wording/nuance tweak that I'd like to try to get working before landing still...
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.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.
LG, shipping it!
Require exact syntactic matching in redeclarations. Provide new terminology for redeclaration matching and agreement. Specify non-redeclaration rules for the other contexts where we require multiple declarations to match, such as `impl`s of `interfaces`, `impl`s of `virtual fn`s. --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com> Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This refactors how the implicit import is handled in order to retain more name scope information. As a consequence, private access control works better between api files and implementation files. Note though that this will also be essential for name poisoning between the API and implementation, as discussed in #3763. In implementing this, I ran into a couple issues with namespaces that I think point to flaws in their handling. I've fixed some and added a TODO for the biggest issue (in check.cpp line 281-288), which relates to the handling of namespaces of direct imports which are first evaluated indirectly.
Trying to pull in key elements of #3762, #3763, and #3980 (decl matching and `extern`, essentially). These aren't specific to any particular declaration type, but are common to entities, so suggesting a new doc oriented on that. There's probably more that could be said here, I'm just focused on getting the recent formal discussion mirrored into the design. --------- Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
Update impl handling to more closely match other kinds of declaration, including support for declaring and defining gneeric `impl`s. When of performing redeclaration lookup for impls by looking for the self and constraint type, produce a list of impls rather than a single impl because it's possible for there to be multiple impls with different deduced parameters but the same self type and constraint. Following #3763, only consider impls to be redeclarations if they're spelled the same, not just if they have the same self and constraint types. No support yet for impl selection to deduce the arguments of a generic impl. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
* Implement ignoring the difference between `Self as` and `as`, as well as `where` clauses at the end of an `impl` declaration when checking whether `impl` declarations match, from #3763. * Allow impl declarations with different constraint ids to match, as long as the facet type of the constraint has the same interface_id and specific_id. * Add some TODOs reflecting future facet type resolution. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Require exact syntactic matching in redeclarations. Provide new terminology for
redeclaration matching and agreement. Specify non-redeclaration rules for the
other contexts where we require multiple declarations to match, such as
impl
sof
interfaces
,impl
s ofvirtual fn
s.