-
Notifications
You must be signed in to change notification settings - Fork 10.6k
GSB: getConformanceAccessPath() doesn't need to use getMinimalConformanceSource() #36402
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
GSB: getConformanceAccessPath() doesn't need to use getMinimalConformanceSource() #36402
Conversation
…anceSource() Previously we would look for a derived source before an explicit one, on account of the explicit one possibly being redundant. However, the presence of 'self-derived' sources meant that we had to call getMinimalConformanceSource() to ensure the derived sources were actually usable and would not produce an infinite conformance access path. I'd like to remove getMinimalConformanceSource() now that we have an alternate algorithm to identify redundant explicit requirements. Instead, we can handle the explicit case first, by checking for a conformance requirement in the generic signature -- its presence means it was not redundant, by construction. Then once we handle that case, we know we're going to use a derived source, and finding the shortest one seems to be good enough. This fixes the IRGen crash in https://bugs.swift.org/browse/SR-11153; the requirement signatures in that test still have unnecessary same-type requirements printed, so I added a separate RUN: line for those, and it's marked as known-failing with 'not %FileCheck'.
This test case was also posted by a developer in https://bugs.swift.org/browse/SR-11153, but it appears to be a different problem that was fixed in Swift 5.2.
|
@swift-ci Please test |
|
@swift-ci Please test source compatibility |
|
Build failed |
|
@swift-ci Please test macOS |
|
@swift-ci Please smoke test macOS |
|
Build failed |
|
Hi @slavapestov, this appears to have caused a regression on my Fedora 33 (x86-64) box. Any theories? |
|
Whoops, the regression was actually the other pull request you merged this morning: #36411 |
I added this test case in swiftlang#36402; the change in swiftlang#36411 correctly flags some bogus same-type requirements in a minimized signature and asserts.
Previously we would look for a derived source before an explicit one,
on account of the explicit one possibly being redundant. However, the
presence of 'self-derived' sources meant that we had to call
getMinimalConformanceSource() to ensure the derived sources
were actually usable and would not produce an infinite conformance
access path.
I'd like to remove getMinimalConformanceSource() now that we have
an alternate algorithm to identify redundant explicit requirements.
Instead, we can handle the explicit case first, by checking for a
conformance requirement in the generic signature -- its presence
means it was not redundant, by construction.
Then once we handle that case, we know we're going to use a derived
source, and finding the shortest one seems to be good enough.
This fixes the IRGen crash in https://bugs.swift.org/browse/SR-11153;
the requirement signatures in that test still have unnecessary
same-type requirements printed, so I added a separate RUN: line
for those, and it's marked as known-failing with 'not %FileCheck'.