On Sat, 28 Jan 2017 16:42:46 -0800, mt1...@gmail.com wrote:
> Hi,
> 
> I get the following error using version 2016.08.1-66-g1ff1aae built on 
> MoarVM version 2016.08
> implementing Perl 6.c.
> 
> Cannot resolve caller BUILD(CC+{RR}: ); none of these signatures match:
>      (CC $: Str :$t!, *%_)
>      (CC $: Int :$i!, *%_)
>    in block <unit> at Build2.pl6 line 15
> 
> 
> 
> The code which generates the error (on the line with '$c does RR');
> 
> 
> role RR { }
> 
> class CC {
> 
>    multi submethod BUILD ( Str :$t! ) { }
>    multi submethod BUILD ( Int :$i! ) { }
> }
> 
> my CC $c .= new(:t<text1>);
> $c does RR;
> 
> 
> Removing the last line and add a trait 'does' to the class works but is 
> not what I want.
> 
> Greetings,
> Marcel


Some observations:

1) All submethods are affected and sticking `Any` or `Mu` into invocant doesn't 
help (perhaps correctly, because these are *sub*methods?):

  <Zoffix> m: role RR {}; class Foo { multi submethod foo($x) { $x.say } }; 
(Foo.new does RR).foo: 42
  <camelia> rakudo-moar aac9ef: OUTPUT«Cannot resolve caller foo(Foo+{RR}: 
Int); none of these signatures match:␤    (Foo $: $x, *%_)␤  in block <unit> at 
<tmp> line 1␤␤»
  <Zoffix> m: role RR {}; class Foo { multi submethod foo(Any: $x) { $x.say } 
}; (Foo.new does RR).foo: 42
  <camelia> rakudo-moar aac9ef: OUTPUT«Cannot resolve caller foo(Foo+{RR}: 
Int); none of these signatures match:␤    ($: $x, *%_)␤  in block <unit> at 
<tmp> line 1␤␤»
  <Zoffix> m: role RR {}; class Foo { multi submethod foo(Mu $: $x) { $x.say } 
}; (Foo.new does RR).foo: 42
  <camelia> rakudo-moar aac9ef: OUTPUT«Cannot resolve caller foo(Foo+{RR}: 
Int); none of these signatures match:␤    (Mu $: $x, *%_)␤  in block <unit> at 
<tmp> line 1␤␤»

2) Functionality of multi submethods seems busted. For example here's the multi 
no match error occurs:

    <Zoffix> m: class Bar { multi submethod BUILD() {} }; class Foo is Bar 
{}.new
    <camelia> rakudo-moar aac9ef: OUTPUT«Cannot resolve caller BUILD(Foo: ); 
none of these signatures match:␤    (Bar $: *%_)␤  in block <unit> at <tmp> 
line 1␤␤»

But goes away if we use the second class in the invocant:

    <Zoffix> m: class Foo {…};class Bar { multi submethod BUILD(Foo:) {} }; 
class Foo is Bar {}.new
    <camelia> rakudo-moar aac9ef: ( no output )

3) The multi build works in this configuration of being in role and class and 
role being mixed in advance:

    <Zoffix> m: role RR {multi submethod BUILD(:$x!) {say "role"}}; class Foo 
does RR { multi submethod BUILD(:$y!) {say "hi"} }; Foo.new: :x
    <camelia> rakudo-moar aac9ef: OUTPUT«role␤»
    <Zoffix> m: role RR {multi submethod BUILD(:$x!) {say "role"}}; class Foo 
does RR { multi submethod BUILD(:$y!) {say "hi"} }; Foo.new: :y
    <camelia> rakudo-moar aac9ef: OUTPUT«hi␤»

As long as invocant marker matches the class the submethod's in:

    <Zoffix> m: role RR {multi submethod BUILD(:$x!) {say "role"}}; class Foo 
does RR { multi submethod BUILD($: :$y!) {say "hi"} }; Foo.new: :y
    <camelia> rakudo-moar aac9ef: OUTPUT«Cannot resolve caller BUILD(Foo: :y); 
none of these signatures match:␤    ($: :$y!, *%_)␤    (Foo $: :$x!, *%_)␤  in 
block <unit> at <tmp> line 1␤

4) Getting this weird error about two unnamed parameters, which happens only 
when I use `:$` named in class and try to mix in a role that has another multi 
with some named param. waat:

    <Zoffix> m: class Foo { multi submethod BUILD(:$) {say "hi"} }; Foo.new
    <camelia> rakudo-moar aac9ef: OUTPUT«hi␤»
    <Zoffix> m: role RR {multi submethod BUILD() {say "role"}}; class Foo does 
RR { multi submethod BUILD(:$) {say "hi"} }; Foo.new
    <camelia> rakudo-moar aac9ef: OUTPUT«hi␤»
    <Zoffix> m: role RR {multi submethod BUILD(:$x) {say "role"}}; class Foo 
does RR { multi submethod BUILD(:$) {say "hi"} }; Foo.new
    <camelia> rakudo-moar aac9ef: OUTPUT«===SORRY!=== Error while compiling 
<tmp>␤Found named parameter '(unnamed)' twice in signature :(Foo $: $, *%_): 
*%_ vs $␤at <tmp>:1␤»

Reply via email to