Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
RT #76882: calling methods with sub call syntax outside the class
  • Loading branch information
moritz committed Sep 12, 2013
1 parent a851ef3 commit 03d12d6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion S12-introspection/can.t
Expand Up @@ -8,7 +8,7 @@ Tests for can.
=end pod

plan 24;
plan 25;

# L<S12/"Introspection"/Unlike in Perl 5 where .can returns a single Code object>

Expand Down Expand Up @@ -101,4 +101,14 @@ my $pup = Puppy.new();
#?niecza todo
ok Str.can('split') ~~ /split/, 'return value of .can stringifies sensibly';

{
# RT #76882
my class A {
method b() { 'butterfly' }
}
sub callit($invocant, $method) { $method($invocant) };
is callit(A.new, A.^can('b')[0]), 'butterfly',
'can call method reference outside the class';
}

# vim: ft=perl6

0 comments on commit 03d12d6

Please sign in to comment.