Skip Menu |
Report information
Id: 128211
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: jns+bc [at] gellyfish.co.uk
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: multi BUILD defined in role gets messed up in sub-class
Download (untitled) / with headers
text/plain 1012b
Consider the following: role Foo { has $!attribute; multi submethod BUILD(Str :$!attribute!) { say "with attribute"; } } class Bar does Foo { multi submethod BUILD(Str :$foo!) { say "with foo"; $!attribute = "default"; } method foo() { say $!attribute; } } class Zub is Bar { } Bar.new(attribute => "set").foo; Bar.new(foo => "something").foo; Zub.new(attribute => "set").foo; Zub.new(foo => "something").foo; Resulting in: with attribute set with foo default Cannot call BUILD(Zub: Str); none of these signatures match: (Bar $: Str :$foo!, *%_) (Bar $: Str :attribute($!attribute)!, *%_) in block <unit> at tt line 25 It appears that it is trying to call the BUILD with a *positional* in the sub-class, however supplying the candidate that it reports it is trying to call doesn't effect the outcome, which is somewhat odd in itself. Unfortunately the call path which leads to this state of affairs is not clear to me at all.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org