Skip to content
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

Fix async return handling #92

Open
wants to merge 3 commits into
base: pdg
Choose a base branch
from

Conversation

JustusAdam
Copy link
Contributor

@JustusAdam JustusAdam commented Feb 8, 2024

Fixes the parent-to-child translation of async functions.

The prior code assumed that the type of the destination place an async function returns from is the same as the type of _0 in the child. However it is instead Poll<...>. This adds the requisite projections to the destination place to make this work out. In particular it adds a Downcast (because Poll is an enum and the Ready variant is the one that carries the actual result) and a Field projection (because a variant downcast is always followed by a projection onto one of the fields).

I also refactored translate_to_parent slightly so it is just one match statement. I think that is clearer.

We should probably add some test cases for this but I've verified that this works in the Paralegal tests.

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