Skip to content

AST: Tweak a concrete-nested-type-of-archetype hack slightly #10439

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

Conversation

slavapestov
Copy link
Contributor

When an archetype conforms to a protocol abstractly (ie, it is
not class-constrained and we don't have any further information
other than that it conforms), we can recover nested types,
but we cannot recover the conformance of those nested types
to protocols if those conformances are concrete (the nested
type might be concrete, or it might be a class-constrained
archetype).

To work around this, we added a hack where if the conformance
lookup in the SubstitutionMap fails, we fall back to the module.

This is horrible and unprincipled, but has to remain in place
until more infrastructure is plumbed through.

Commit 620db5f made this
workaround apply in fewer cases, so that we could still catch
cases where the SubstitutionMap was constructed with missing
conformances.

Unfortunately this workaround didn't handle the case where the
nested type was an archetype with a superclass constraint.

This will all go away soon, but for now tweak the logic a bit,
since I really want to keep the "narrow" workaround in place
and not the general fallback, otherwise we run the risk of
SubstitutionMap conformance lookup bitrotting completely.

Fixes https://bugs.swift.org/browse/SR-4088 and
rdar://problem/32773028.

When an archetype conforms to a protocol abstractly (ie, it is
not class-constrained and we don't have any further information
other than that it conforms), we can recover nested types,
but we cannot recover the conformance of those nested types
to protocols if those conformances are concrete (the nested
type might be concrete, or it might be a class-constrained
archetype).

To work around this, we added a hack where if the conformance
lookup in the SubstitutionMap fails, we fall back to the module.

This is horrible and unprincipled, but has to remain in place
until more infrastructure is plumbed through.

Commit 620db5f made this
workaround apply in fewer cases, so that we could still catch
cases where the SubstitutionMap was constructed with missing
conformances.

Unfortunately this workaround didn't handle the case where the
nested type was an archetype with a superclass constraint.

This will all go away soon, but for now tweak the logic a bit,
since I really want to keep the "narrow" workaround in place
and not the general fallback, otherwise we run the risk of
SubstitutionMap conformance lookup bitrotting completely.

Fixes <https://bugs.swift.org/browse/SR-4088> and
<rdar://problem/32773028>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit c21699b into swiftlang:master Jun 21, 2017
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.

1 participant