-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Type checker] Minimize checking needed to compute the set of overridden declarations #17729
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
[Type checker] Minimize checking needed to compute the set of overridden declarations #17729
Conversation
Rather than deferring to the heavyweight validateDeclForNameLookup() to perform the “get overridden decls” operation, perform a much more minimal validation that only looks for exact matches when the ‘override’ modifier is present. The more-extensive checking (e.g., that one didn’t forget an override modifier) is only performed as part of the “full” type checking of a declaration, which will typically only be done within the same source file as the declaration. The intent here is to reduce the amount of work performed to check overrides cross-file, and limit the dependencies of the “get overridden decls” operation.
Note that two tests are currently failing, so this PR isn't quite complete yet:
|
This PR is getting too big; I've split out the refactoring part as #17733 |
'dynamic' is inherited and only applies to '@objc' entities. The SourceKit test change is because we've changed our behavior slightly: we won't infer @objc from an override unless the override is correctly marked with 'override'. This is part of breaking up dependencies, and should have little effect outside of tests.
e2bfbcc
to
a3e03fa
Compare
@swift-ci please smoke test |
@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 |
When computing the type of a potentially-overriden declaration, make sure we have an interface type. Add a test to ensure that we validate overrides cross-file correctly.
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please test compiler performance |
1 similar comment
@swift-ci please test compiler performance |
Build comment file:Compilation-performance test failed |
Refactor the checking of overridden declarations so we only perform the minimal work to answer the question "what declarations to this declaration override?". Includes a healthy refactoring of the previously-monolithic
TypeChecker::checkOverrides()
into re-usable pieces that are far easier to reason about than before.