Skip to content

Fix variadic-generic class method dispatch #70707

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

Conversation

rjmccall
Copy link
Contributor

@rjmccall rjmccall commented Jan 4, 2024

It's important to set substitutions on generic abstraction patterns so that we can maintain the parallel structure with the substituted type properly.

Builds on top of #70681.

Part of the fix for rdar://119899063

to map formal types into the new environment.
with walking the tuple so that they can be used without an address.
patterns) in argument positions in reabstraction thunks.

Most of the difficulty in this work continues to center around
(1) trying to reuse as much code as possible between the parameter
and result paths and (2) propagating ownership information as
necessary throughout the code.  I did my best to assert the preconditions
and postconditions here, but undoubtedly I'm missing cases.  Some
simplicity here is still eluding me here.

This patch necessarily changes quite a bit of the code used in
non-variadic paths.  I tried to avoid doing things that I knew would
be risky, like optimizing copies.  I did fail in a few places: e.g.
we should now generate significantly better code when erasing to
Optional<Any>, just because the code was oddly poorly-factored before.
You can see the effect on the function_conversion test case.
@rjmccall
Copy link
Contributor Author

rjmccall commented Jan 4, 2024

@swift-ci Please test

@rjmccall rjmccall merged commit 77c26a7 into swiftlang:main Jan 4, 2024
@rjmccall rjmccall deleted the variadic-generic-class-method-dispatch branch January 4, 2024 17:38
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