-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[4.1] [SubstitutionMap] Handle conformance lookup via superclass requirements. #14850
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] [SubstitutionMap] Handle conformance lookup via superclass requirements. #14850
Conversation
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.
@swift-ci please test |
@swift-ci please nominate |
Build failed |
Build failed |
Ugh, it's a mangling change. |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please nominate |
Build failed |
Build failed |
@swift-ci please test |
@swift-ci please test Linux |
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.