Skip to content

RequirementMachine: Concrete contraction needs to substitute the parent type of a subject type sometimes [5.7] #59325

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

@slavapestov slavapestov commented Jun 8, 2022

Cherry-pick of #59310.

If you have generic parameters <T, U> and requirements of the form:

  • T : P
  • T == ConcreteType<U>
  • T.[P]U : SomeClass
  • T.[P]U : SomeProto

And furthermore SomeClass does not conform to SomeProto, we can't leave T.[P]U : SomeClass unsubstituted; we still have to replace T with ConcreteType<U> to transform the latter two requirements into:

  • U : SomeClass
  • U : SomeProto

"Concrete contraction" is easily the hackiest part of the Requirement Machine; I need to come up with a more principled solution for the problem that it solves sooner or later.

Fixes rdar://problem/94150249.

…ral mode

We resolve protocol typealiases to DependentMemberTypes because the
Requirement Machine treats them as rewrite rules. However, it doesn't
do this for typealiases in protocol extensions.

Fixes rdar://problem/94150249.
…nt type of a subject type sometimes

If you have generic parameters <T, U> and requirements of the form:

- T : P
- T == ConcreteType<U>
- T.[P]U : SomeClass
- T.[P]U : SomeProto

And furthermore SomeClass does not conform to SomeProto, we can't leave
`T.[P]U : SomeClass` unsubstituted; we still have to replace `T` with
`ConcreteType<U>` to transform the latter two requirements into:

- U : SomeClass
- U : SomeProto

"Concrete contraction" is easily the hackiest part of the Requirement
Machine; I need to come up with a more principled solution for the
problem that it solves sooner or later.

Fixes rdar://problem/94150249.
@slavapestov slavapestov requested a review from a team as a code owner June 8, 2022 19:38
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov merged commit 166e587 into swiftlang:release/5.7 Jun 9, 2022
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.7 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants