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.
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 insteadPoll<...>
. This adds the requisite projections to the destination place to make this work out. In particular it adds aDowncast
(becausePoll
is an enum and theReady
variant is the one that carries the actual result) and aField
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.