-
Notifications
You must be signed in to change notification settings - Fork 10.6k
InheritedProtocolConformance: Return the conforming type's DeclContext #2075
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
InheritedProtocolConformance: Return the conforming type's DeclContext #2075
Conversation
|
@DougGregor Does this look reasonable for 2.2? There's something more subtle going on that I don't fully understand, and wouldn't want to mess with in the scope of 2.2. @bitjammer made this change to master as b0d6341 for other reasons, and it also gets deserialization working in the case of SR-1158. |
|
@swift-ci Please test |
|
@tkremenek Can we take this for 2.2 (contingent on tests passing and @DougGregor's approval)? |
|
@jckarter Yes we can take it, assuming review and testing passes. |
|
Test fails: |
|
@jckarter Is this just a test case that needs to be updated, or something more? |
|
@tkremenek Yeah, the test case can just be updated. I'll take care of it and start the tests again. |
|
FYI, @DougGregor signed off offline on this change. |
Not the superclass's. This can cause mapping types out of context to not
resolve archetypes, because the DeclContexts won't match, e.g:
internal class _IteratorBox<Base: IteratorProtocol> :
_AnyIteratorBoxBase<Base.Element> { internal override func next() ->
Base.Element? }
Here, _IteratorBox's associated type Element for IteratorProtocol is
Base.Element, but the conformance comes from the superclass,
_AnyIteratorBoxBase. This meant that Base.Element couldn't be mapped to
an interface type, which should be:
(dependent-member
(generic-type-parameter depth=0 index=0) member=Element)
The old behavior also broke inherited conformances across serialization boundaries, because subclasses would fail to inherit conformances a deserialized class inherited itself from a base class (SR-1158).
5afeddc to
e6d8787
Compare
|
@swift-ci Please test |
Not the superclass's. This can cause mapping types out of context to not
resolve archetypes, because the DeclContexts won't match, e.g:
internal class _IteratorBox<Base: IteratorProtocol> :
_AnyIteratorBoxBase<Base.Element> { internal override func next() ->
Base.Element? }
Here, _IteratorBox's associated type Element for IteratorProtocol is
Base.Element, but the conformance comes from the superclass,
_AnyIteratorBoxBase. This meant that Base.Element couldn't be mapped to
an interface type, which should be:
(dependent-member
(generic-type-parameter depth=0 index=0) member=Element)
The old behavior also broke inherited conformances across serialization boundaries, because subclasses would fail to inherit conformances a deserialized class inherited itself from a base class (SR-1158).