Skip to content

[5.9] A few SILGen fixes for variadic generics #66684

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 5 commits into from
Jun 16, 2023

Conversation

rjmccall
Copy link
Contributor

@rjmccall rjmccall commented Jun 15, 2023

Explanation: Fixes a handful of bugs relating to code (SIL) emission for variadic generics, mostly relating to tuple types. Bugs are described in the individual commits.
Scope: changes are mostly isolated to paths specific to variadic generics; there are some exceptions, but they just make the code follow well-established code patterns
Risk: Low
Reviewed by: Holly Borla, Joe Groff

Fixes rdar://107290521, rdar://109843932, rdar://109911655, and #66594.

5.9 version of #66658 and #66683.

rjmccall added 5 commits June 15, 2023 17:26
SILGen expects this of values before we enter general routines.

Fixes rdar://109911655
variadic-tuple results.  There are three parts to this.

First, fix the emission of indirect result parameters to do a
proper abstraction-pattern-aware traversal of tuple patterns.
There was a FIXME here and everything.

Second, fix the computation of substituted abstraction
patterns to properly handle vanishing tuples.  The previous code
was recursively destructuring tuples, but only when it saw a
tuple as the substituted type, which of course breaks on vanishing
tuples.

Finally, fix the emission of returns into vanishing tuple
patterns by allowing the code to not produce a TupleInitialization
when the tuple pattern vanishes.  We should always get a singleton
element initializer in this case.

Fixes rdar://109843932, plus a closely-related test case for
vanishing tuples that I added myself.
I don't like that this method exists, and I'd like to rip it out
in favor of expecting an opaque lowering, but I'm worried about
doing that this late in 5.9.

Fixes rdar://107290521
@rjmccall rjmccall requested a review from a team as a code owner June 15, 2023 21:27
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall rjmccall merged commit a9e43a7 into swiftlang:release/5.9 Jun 16, 2023
@rjmccall rjmccall deleted the variadic-generics-fixes-5.9 branch June 16, 2023 04:02
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.

3 participants