As discussed in https://gist.github.com/tokorom/19ae87acf9db5386c0e1 by @tokorom,
self.request1()
.success { _ -> Task<Progress, Int, Bool> in
// A
return self.request2()
}
.success { _ in
// B
}
(B) gets called first before self.request2() completes.
This occurs when func request1() and func request2() returns Task type with different Error type,
so that type-inference will fail and uses "map" version of then rather than "flatMap" version of it.
We need more strict type constraint to avoid this issue, or add an alias method name to distinguish two methods.
As discussed in https://gist.github.com/tokorom/19ae87acf9db5386c0e1 by @tokorom,
(B) gets called first before
self.request2()completes.This occurs when
func request1()andfunc request2()returns Task type with different Error type,so that type-inference will fail and uses "map" version of
thenrather than "flatMap" version of it.We need more strict type constraint to avoid this issue, or add an alias method name to distinguish two methods.