Make task -> semiFuture -> task preserve void type
Summary: Task -> semi has to lift void to unit because semifutures don't support void. Semi -> task (via co_await) does not drop unit. It probably should because roundtrip properties are nice, but on the off chance someone actually wants to pass a unit around that would become impossible. But for the result type the Try<void> is already implicitly convertible to Try<Unit>, as those types aren't meaningfully different (and not at all in this context where empty Try is not possible). So we can return Try<void> from co_awaitTry instead of Try<Unit>, and then generic code that wants `co_yield co_result(co_await co_awaitTry(SemiFuture<T|Unit>))` from a `Task<T|void>` will work. Reviewed By: andriigrynenko Differential Revision: D23004090 fbshipit-source-id: 5254e2930ac02952abd92fd2856c2a7d3e952e20
Showing
Please register or sign in to comment