Subject: | wait_all() etc. always returns a plain Future when no argument is given. |
wait_all, wait_any, needs_all, needs_any methods correctly respect
Future subclasses when some Future instances are given as arguments.
However, if there is no argument, it always returns a plain
Future. See the attached test script.
I propose it respect the $class argument when there is no argument. So
in the following case
my $f = Future::Sub->wait_all();
$f should be an instance of Future::Sub.
Subject: | dependent_future_subclass.t |
use strict;
use warnings;
use Test::More;
package Future::Sub;
use base qw(Future);
package main;
foreach my $method (qw(wait_all wait_any needs_all needs_any)) {
my $parent = Future::Sub->new;
my $f = Future::Sub->$method($parent);
isa_ok $f, "Future::Sub", "$method: non-empty arg: subclass OK";
$f = Future::Sub->$method();
isa_ok $f, "Future::Sub", "$method: empty arg: subclass OK";
}
done_testing;