Skip to content

[GenericEnvironment] Include original parameter packs in opened pack element signatures. #62228

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 7 commits into from
Nov 28, 2022

Conversation

hborla
Copy link
Member

@hborla hborla commented Nov 22, 2022

Model opened pack element signatures as a complete clone of the outer context signature, with an additional set of element type parameters at depth + 1 and corresponding element requirements. The generic environment stores a substitution map for all generic parameters whose depth is lower than the element depth, using the archetypes from the outer generic context when mapping types into this generic context.

For example, given this generic signature:

<T..., U> where T: P, T.A == U

The opened element generic signature is:

<T_0_0..., T_0_1, T_1_0> where T_0_0: P, T_1_0: P, T_0_0.[P]A == T_0_1, T_1_0.[P]A == T_0_1

where T_1_0 represents an element in T_0_0. The element generic environment also stores substitutions for T_0_0 and T_0_1 to the archetypes created in the generic context of the original signature.

…te clone

of the outer context signature, with an additional set of element type parameters
at depth + 1.
…arameters

of an opened pack element generic environment.
@hborla hborla force-pushed the pack-element-generic-environment branch from e4982ca to 8ec5405 Compare November 23, 2022 16:17
@hborla hborla marked this pull request as ready for review November 23, 2022 16:39
…element

archetypes to their originating pack archetypes.
@hborla hborla force-pushed the pack-element-generic-environment branch from 3273be7 to 8db8b7c Compare November 23, 2022 19:49
…res in

getOrCreateArchetypeFromInterfaceType.

Instead of special casing parameter packs for primary generic environments,
handle parameter packs in each kind of environment. For opened element
environments, a pack archetype can be produced from the outer substitutions.
@hborla hborla force-pushed the pack-element-generic-environment branch from fd97dac to bdab953 Compare November 23, 2022 20:10
…cs for

same-type requirements where one side is a parameter pack.
generating constraints for PackExpansionExpr.

The result pattern type of a pack expansion doesn't always contain pack
references. Instead, use the type of the first pack reference binding.
@hborla hborla requested a review from slavapestov November 28, 2022 00:16
@hborla
Copy link
Member Author

hborla commented Nov 28, 2022

@swift-ci please smoke test

1 similar comment
@hborla
Copy link
Member Author

hborla commented Nov 28, 2022

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Nov 28, 2022

@swift-ci please smoke test macOS

@hborla
Copy link
Member Author

hborla commented Nov 28, 2022

@swift-ci please smoke test

1 similar comment
@hborla
Copy link
Member Author

hborla commented Nov 28, 2022

@swift-ci please smoke test

@hborla hborla merged commit c225fc4 into swiftlang:main Nov 28, 2022
@hborla hborla deleted the pack-element-generic-environment branch November 28, 2022 20:34
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.

2 participants