Skip to content

Conversation

DougGregor
Copy link
Member

Explanation: Teach SubstitutionMap's conformance lookup to
detect the case where a conformance can only be determined by lookup for a
concrete conformance on the superclass bound of a type variable, which otherwise
would fail (causing a crash).
Scope: Affects projects that make use of superclass bounds in certain specific cases, potentially triggered by the optimizer.
Risk: Very low; we're only changing behavior along a path that would otherwise fail (and crash).
Testing: Regression tests, including a new test reduced by @eeckstein
Reviewer: @eeckstein, who developed this with me
SR / Radar: SR-7072 / rdar://problem/37904576.

Conformances that discoverably for a type parameter via a superclass
requirement occupy a bit of a gray area in the type checker and
generic signature handling right now: we have a type parameter (so the
paths that handle concrete conformances don't kick in), but the
conformance itself isn't modeled as a requirement because it is
available via lookup. Teach SubstitutionMap's conformance lookup to
detect this case and perform conformance lookup in the generic
signature (i.e., falling back to global lookup) in this case,
replicating the hack that IRGen uses to address the same issue when
accessing the conformance (see GenArchetype.cpp's TODO where we lookup
a conformance on the superclass). The removal of that hack (as well as
this one) are tracked by rdar://problem/34609744.

For now, fixes SR-7072 / rdar://problem/37904576.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please nominate

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c370f6b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c370f6b

@DougGregor
Copy link
Member Author

Ugh, it's a mangling change.

@DougGregor
Copy link
Member Author

@swift-ci please test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please nominate

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9b4c630

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9b4c630

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor DougGregor merged commit 30e0bea into swiftlang:swift-4.1-branch Feb 27, 2018
@DougGregor DougGregor deleted the lookup-conformance-via-superclass-bound-4.1 branch February 27, 2018 22:54
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