# New Ticket Created by  Lard Farnwell 
# Please include the string:  [perl #117605]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117605 >


Hi,

As I ran in IRC,

[13:12] <lard> perl6: class foo { multi method bar(:$baz) { say ">",$baz,"<"}}; 
foo.new.bar(:baz<works>);foo.new.bar(:derp('rakudo runs method even though 
nothing matches sig'));
[13:12] <+p6eval> niecza v24-37-gf9c8fc2: OUTPUT«>works<␤Unhandled exception: 
Cannot call bar; none of these signatures match:␤    foo, Any :$baz␤  at 
/tmp/W2hmEFv_In line 1 (mainline @ 9) ␤  at 
/home/p6eval/niecza/lib/CORE.setting line 4299 (ANON @ 3) ␤  at 
/home/p6eval/niecza/lib/CORE.setting line 4300…
[13:12] <+p6eval> ..rakudo b5bdbe: OUTPUT«>works<␤>(Any)<␤»

Rakudo is incorrectly binding to methods with a named variable, even if the 
named variable with witch it was called does not exist. I don't really know 
what I and doing but it looks like, BOOTSTAP.pm line 1039.

                            # First, if there's a required named parameter and 
it was                                                                          
                                                                        
                            # not passed, we can very quickly eliminate this 
candidate                                                                       
                                                                          
                            # without doing a full bindability check.           
                                                                                
                                                                       
                            if nqp::existskey(%info, 'req_named')               
                                                                                
                                                                       
                            && !nqp::captureexistsnamed($capture, 
nqp::atkey(%info, 'req_named')) {                                               
                                                                                
     
                                # Required named arg not passed, so we 
eliminate                                                                       
                                                                                
                                # it right here. Flag that we've built a list 
of                                                                              
                                                                         
                                # new possibles, and that this was not a pure   
                                                                                
                                                                       
                                # type-based result that we can cache.          
                                                                                
                                                                       
                                $new_possibles := [] unless 
nqp::islist($new_possibles);                                                    
                                                                                
           
                            } 

That 'if' is failing in the case, where as it should succeed. The if fails, the 
'else' gets run, which is the binding step which shouldn't be running. Result: 
named params in methods don't work properly especially with multi methods.
I don't know enough about NQP to go further.


Cheers,

Lard

Reply via email to