-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.9] Omnibus merge of some recent variadic generics work #64683
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
rjmccall
merged 30 commits into
swiftlang:release/5.9
from
rjmccall:variadic-generics-omnibus-5.9
Mar 29, 2023
Merged
[5.9] Omnibus merge of some recent variadic generics work #64683
rjmccall
merged 30 commits into
swiftlang:release/5.9
from
rjmccall:variadic-generics-omnibus-5.9
Mar 29, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
whichever case it happens to be in. This is a basic fix so that parallel walks on tuples and function types in the substituted type will work . Separately, though, I do not think the places that use this really need to be passed an orig type; this is used for computing type properties, and I am not aware of any reason we should need an orig type to compute type properties. Additionally, the orig types computed by this function are not really correct because of the substitution being done in some cases, so it'd be very nice to rip this all out. I'm not good to look into that right now, though.
needs to be lowered, use an opaque abstraction pattern. As I argue in the comment, we know that the orig type is now either an opaque type or a type with high-level structure that is invariant to lowering. Substitution will not change the latter property, and an opaque abstraction pattern is correct for the former. Attempting to create a "truer" abstraction pattern that preserves more structure from the orig type is both pointless and problematic. The substitutions we just did may have replaced pack references with non-pack types if there are active expansions in progress; this cannot be easily explained in terms of substitutions. (In theory, we could pass a more opaque concept of substitutions through AbstractionPattern, which might help with this. That would also make it harder to catch bugs with signature mismatches, though.)
properties for struct and enum types.
argument emission.
My original test case here used a memberwise initializer, but those use their own logic for binding and forward parameters which will need to be updated separately.
Just for brevity's sake.
There are a lot of problems caused by our highly-abstract substitution subsystem. Most of them would be solved by a more semantic / holistic understanding of the active transformation, but that's difficult to do because we just pass around function_refs. The first step in fixing that is to pass around a better currency type. For now, it can just hold the function_refs (and the SubstOptions). I've set it up so that the places that just apply SubstitutionMaps are constructing the IFS in a standard way; that should make it easy to change those places in the future.
Substitution of a pack expansion type may now produce a pack type. We immediately expand that pack when transforming a tuple, a function parameter, or a pack. I had to duplicate the component-wise transformation logic in the simplifyType transform, which I'm not pleased about, but a little code duplication seemed a lot better than trying to unify the code in two very different places. I think we're very close to being able to assert that pack expansion shapes are either pack archetypes or pack parameters; unfortunately, the pack matchers intentionally produce expansions of packs, and I didn't want to add that to an already-large patch.
a subst abstraction pattern from a generic nominal type.
Fixes rdar://107151145
into an Initialization. rdar://107161241
@swift-ci Please test |
hborla
approved these changes
Mar 28, 2023
First step in preparation to unify different matchers which is effectively no-op because function parameters do not have labels. - Common prefix/suffix should account for presence of labels - Labeled parameters cannot appear in the region absorbed by a pack expansion type.
@swift-ci Please test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contains the patches from my PRs #64529, #64575, #64578, and #64681, as well as @xedin's PR #64591.