-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Name lookup] Introduce a request for "extended nominal type decl" #18425
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
@swift-ci please smoke test and merge |
3b5cadc
to
197a525
Compare
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
The line notes are messed up again, gah! Basically I’m confused why we ever call bindExtension() directly - are there invalid nested extensions that do lookup into other extensions during binding or something? |
(Writing here because my rebase made line-specific commentary hard to follow) @slavapestov I confused the issue because I effectively added another level of "binding" for extensions without giving it a name. Here are the three effective "levels":
Prior to this pull request, the first two levels were the same. This pull request splits them apart, creates a request for the former, and scatters |
#18490 removed the |
@swift-ci please smoke test Linux |
Introduce ExtensionDecl::getExtendedNominal() to provide the nominal type declaration that the extension declaration extends. Move most of the existing callers of the callers to getExtendedType() over to getExtendedNominal(), because they don’t need the full type information. ExtensionDecl::getExtendedNominal() is itself not very interesting yet, because it depends on getExtendedType().
Introduce a request for ExtensionDecl::getExtendedNominal() that uses TypeRepr-based resolution to find the extended nominal type declaration without going through type resolution.
…icAncestor(). This operation does not require type information, so move it over to ClassDecl where this information is more generally useful.
Use ExtensionDecl::getExtendedNominal() to wire up extensions to their nominal types early in type checking (the bindExtensions()) operation, rather than going through type validation to do so.
197a525
to
3018bec
Compare
@swift-ci please smoke test Linux |
1 similar comment
@swift-ci please smoke test Linux |
IR generation depends on these when it emits type metadata.
@swift-ci please smoke test Linux |
@swift-ci please test source compatibility |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test macOS |
1 similar comment
@swift-ci please smoke test macOS |
@swift-ci please test Linux |
1 similar comment
@swift-ci please test Linux |
Introduce
ExtensionDecl::getExtendedNominal()
to provide the nominaltype declaration that the extension declaration extends. Move most
of the existing callers of the callers of
getExtendedType()
over togetExtendedNominal()
, because they don’t need the full type information.Introduce a request to back
ExtensionDecl::getExtendedNominal()
, whichuses the type-decl-resolution path that doesn't go through a
Type
. Use thatto reduce the dependence of the early "extension binding" pass (which associates
extension declarations with nominal types) on the type checker.