Skip to content

Commit

Permalink
Add a test for valid processing of a multi submethod
Browse files Browse the repository at this point in the history
Since we do not spec `.^submethod_table`, I don't currently see a way to
test if a `multi submethod` is processed correctly by the compiler. But
a side effect of the problem was that declaring both `proto` and `multi`
of a submethod resulted in a `method exists` exception.
  • Loading branch information
vrurg authored and Altai-man committed Oct 24, 2020
1 parent 1d17a64 commit 31ad4c8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions S12-methods/multi.t
Expand Up @@ -2,7 +2,7 @@ use v6.d;

use Test;

plan 31;
plan 32;

# L<S12/"Multisubs and Multimethods">
# L<S12/"Trusts">
Expand Down Expand Up @@ -195,4 +195,14 @@ is Bar.new.a("not an Int"), 'Any-method in Foo';
throws-like { B.new.foo("OH HAI") }, X::Method::NotFound, 'multi submethod is not inherited';
}

# vim: ft=perl6
# GH rakudo/rakudo#3976 https://github.com/rakudo/rakudo/issues/3976
{
eval-lives-ok q:to/MULTI-SUBMETHOD/, "Declaring both proto and multi for a submethod doesn't die";
my class A {
proto submethod foo(|) {*}
multi submethod foo() { }
}
MULTI-SUBMETHOD
}

# vim: expandtab shiftwidth=4

0 comments on commit 31ad4c8

Please sign in to comment.