-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[4.1] [IDE] Teach type checker about conditional conformance extensions. #14634
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
[4.1] [IDE] Teach type checker about conditional conformance extensions. #14634
Conversation
No point in getting rid of the sugar so early.
Before conditional conformances, the archetypes in conformance extensions (i.e. extension Foo: SomeProtocol) were equivalent to those in the type decl, with the same protocol bounds and so on. The code for printing "synthesized" members relied on this fact. This commit teaches that code to deal with archetypes in the conditional conformance extension when required. Fixes rdar://problem/36553066 and SR-6930.
@swift-ci please test |
3948e63
to
f883c48
Compare
@swift-ci please test |
Build failed |
Build failed |
Oh, whoops, didn't mean to nominate this one just yet. Don't merge please! |
@swift-ci please nominate |
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.
When adding new code to test/SourceKit/DocSupport
tests, could you add them at the end of the file ? That way you will avoid all the change churn with updating offsets for the existing code that comes after your additions.
Otherwise LGTM.
I thought I did add them at the end of the file? Maybe I added them to the wrong file? |
Apologies, I misunderstood, LGTM. |
• Explanation: The IDE type checker previously didn't understand that some extensions from which it copies items for documentation purposes (e.g.
extension Proto1 { ... }
) might only be conditionally enabled (i.e. a conditional conformance likeextension Foo: Proto1 where T: Proto2
and that the archetypes needed to understand the types of the new items might be different to the archetypes of the nominal type decl (i.e. the archetype forT
has to conform toProto2
for things to make sense). This resulted in somesubst
s failing, and so canonical types not being remapped to the correct user-facing type for things like inclusion in documentation (meaning it can include things likevar last: τ_0_0.Element? { get }
).• Scope of Issue: Only major code changes are in the IDE support code/SourceKit, and those were mostly mechanical.
• Origination: Missed place that needed updating for conditional conformances.
• Risk: Low: the changes are somewhat large (although only ~550 of the 1100 listed added/deleted lines are just changes to generated expected output for a test), but mostly mechanical change, defensively programmed.
• Reviewed By: @DougGregor
• Testing: Compiler regression tests, manual verification of toolchain in Xcode
• Radar / SR: rdar://problem/36553066