flowistry icon indicating copy to clipboard operation
flowistry copied to clipboard

Fix async return handling

Open JustusAdam opened this issue 1 year ago • 0 comments

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.

JustusAdam avatar Feb 08 '24 19:02 JustusAdam