Skip to content

Opaque type fixes for interesting generic environments #40938

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

Merged
merged 4 commits into from
Jan 21, 2022

Conversation

DougGregor
Copy link
Member

Fix a few remaining issues with opaque result types that have "interesting" generic environments:

  • Only build opaque archetype types corresponding to opaque generic parameters, and do normal substitutions for outer generic parameters
  • Correct the IR generation logic for finding a particular witness table in an opaque type. It was hard-coded to only work with opaque type declarations that have a single opaque type in them and a "flat" set of conformances.

Although the tests here are described in terms of named opaque result types (which is hidden behind an experimental flag), the fixes also apply to structural opaque result types and any feature that allows us to add constraints to opaque result types.

When there are same-type constraints involving opaque archetype
parameters and generic parameters of the enclosing environment, a
nested type of an opaque type archetype might in fact refer to
something in the outer environment of the opaque type. Recognize this
case and perform substitutions on such types using the opaque type's
substitutions.
Use the same logic as we do for forming the opaque type result descriptor,
of course.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit d484e12 into swiftlang:main Jan 21, 2022
@DougGregor DougGregor deleted the opaque-witness-table-fixes branch January 21, 2022 01:17
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