Branch: Tag:

2018-04-09

2018-04-09 21:54:02 by Martin Karlgren <marty@roxen.com>

Concurrent.results: Handle an empty argument array properly.

Previously code such as:

Concurrent.Future f2 = Concurrent.results(({}));

f2->on_success(lambda(array(string) a) { werror("success: %O.\n", a); })
->on_failure(lambda(mixed err) { werror (describe_backtrace(err)); });

... would lead to a backtrace because the future was destructed prematurely.

1059:   //! @[all()], @[Promise.depend()]   variant Future results(array(Future) futures)   { +  if(!sizeof(futures)) +  return resolve(({})); +     return Promise()->depend(futures)->future();   }   inline variant Future results(Future ... futures)