Skip to content

Conversation

@DougGregor
Copy link
Member

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.

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.
@DougGregor
Copy link
Member Author

Note that two tests are currently failing, so this PR isn't quite complete yet:

    Swift(macosx-x86_64) :: SourceKit/CursorInfo/cursor_overrides.swift
    Swift(macosx-x86_64) :: Interpreter/generic_objc_subclass.swift

@DougGregor
Copy link
Member Author

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.
@DougGregor DougGregor force-pushed the minimize-override-checking branch from e2bfbcc to a3e03fa Compare July 4, 2018 05:04
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test macOS

1 similar comment
@DougGregor
Copy link
Member Author

@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.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

swift-ci commented Jul 5, 2018

Build comment file:

Compilation-performance test failed

@DougGregor DougGregor merged commit f4359b7 into swiftlang:master Jul 5, 2018
@DougGregor DougGregor deleted the minimize-override-checking branch July 5, 2018 13:38
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