Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Further coverage of RT #121426.
Ensuring the fix interacts correctly with multi-dispatch.
  • Loading branch information
jnthn committed Oct 6, 2015
1 parent 4e9eb58 commit 9d891a0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S06-multi/type-based.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 64;
plan 66;

# type based dispatching
#
Expand Down Expand Up @@ -171,6 +171,19 @@ is(mmd(1..3), 2, 'Slurpy MMD to listop via list');
is f4(@c), 'Array of Array', 'can dispatch on typed Array (Array)';
}

# Multi-dispach on declared return type
# RT #121426
{
sub i() returns Int { 3 }
sub s() returns Str { 'little pigs' }

multi by-return-type(Int &x) { 'Int ' ~ x() }
multi by-return-type(Str &x) { 'Str ' ~ x() }

is by-return-type(&s), 'Str little pigs', 'can dispatch on typed routine (Str)';
is by-return-type(&i), 'Int 3', 'can dispatch on typed routine (Int)';
}

# make sure that multi sub dispatch also works if the sub is defined
# in a class (was a Rakudo regression)
# RT #65674
Expand Down

0 comments on commit 9d891a0

Please sign in to comment.