mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.66k stars 576 forks source link

$promise->reject($val) does the wrong thing when $val is a promise object #1516

Closed akarelas closed 3 years ago

akarelas commented 4 years ago

Steps to reproduce the behavior

my $p1 = Mojo::Promise->new;
my $p2 = Mojo::Promise->new;
$p1->then(
    sub {say "p1 resolved: @_"},
    sub {say "p1 rejected: ", ($_[0] == $p2) ? '$p2' : $_[0]}
);

$p1->reject($p2);

Mojo::IOLoop->one_tick;

This script produces no output.

Expected behavior

The following output should be produced, according to: https://tc39.es/ecma262/#sec-promise-reject-functions point 7, and https://tc39.es/ecma262/#sec-rejectpromise points 3 and 8 (etc)

p1 rejected: $p2

Actual behavior

There was no output

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

akarelas commented 3 years ago

This bug is fixed in master.