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
[AST] Ill-formed @objc protocols might have associated types. #19754
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As an optimization, we don't even look for associated types in @objc protocols. However, this could lead to broken invariants like "every associated type has a witness" in ill-formed @objc protocols that do have associated types. Implement this optimization by checking whether the protocol has a Clang node. Fixes rdar://problem/41425828 / SR-8094.
DougGregor
force-pushed
the
objc-assoc-type-crash
branch
from
October 6, 2018 17:35
e71d3a8
to
83e41da
Compare
@swift-ci please smoke test and merge |
Didn’t we add this to minimize deserialization? |
@swift-ci Please test compiler performance |
@slavapestov I thought it was to avoid Clang importer work, but... you are right that it would affect deserialization, too. Sounds like I have a predicate to change! It also fixed a second existing crasher, so that's good. |
…ted types Thanks to @slavapestov for pointing this out! The optimization to avoid looking through the members of a protocol that can’t possibly have any associated types was for both deserialized protocols and imported protocols, but I only supported the former in my previous change. Check both cases and make the reasons much more obvious. Also, that change resolved an existing compiler crasher as well.
This test case crashed at runtime in Swift 4.2, but is now fixed. Add it so that we don't regress.
@swift-ci please smoke test and merge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As an optimization, we don't even look for associated types in @objc
protocols. However, this could lead to broken invariants like "every
associated type has a witness" in ill-formed @objc protocols that do
have associated types.
Implement this optimization by checking whether the protocol has a
Clang node. Fixes rdar://problem/41425828 / SR-8094.