Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the presence of other multis with named params, Rakudo doesn't fall back to a general hash slurpy multi #1204

Closed
p6rt opened this issue Aug 6, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 6, 2009

Migrated from rt.perl.org#68234 (status was 'resolved')

Searchable as RT68234$

@p6rt
Copy link
Author

p6rt commented Aug 6, 2009

From @masak

It's a948cae51 o'clock, I'm sitting in a nice café with gratis
wireless, and I'm getting this strange effect​: a call dispatches to a
multi variant with a slurpy hash if that's the only variant around,
but it won't find it if other variants are defined.

$ perl6 -e 'multi foo(*%_) { say "unknown" }; foo(​:key); foo(​:unknown)'
unknown
unknown

$ perl6 -e 'multi foo(​:$key!) { say "with key" }; multi foo(*%_) { say
"unknown" }; foo(​:key); foo(​:unknown)'
with key
No applicable candidates found to dispatch to for 'foo'
in Main (<unknown>​:1)

With or with the '!' after '​:$key', this problem occurs.

@p6rt
Copy link
Author

p6rt commented Aug 10, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S06-multi/syntax.t

commit 71dc6c2454e83fb2ca5bc7c424d8284f906fcefd
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Aug 10 21​:51​:49 2009 +0000

  [t/spec] Test for RT #​68234
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27953 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S06-multi/syntax.t b/t/spec/S06-multi/syntax.t
index d0136dd..f5c2b29 100644
--- a/t/spec/S06-multi/syntax.t
+++ b/t/spec/S06-multi/syntax.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 25;
+plan 27;
 
 # L<S06/Routine modifiers/>
 # L<S06/Parameters and arguments/>
@@ -72,4 +72,13 @@ is(~&foo, 'foo',  'a multi stringifies sensibly');
     is nsi_2(1, 2, 3),                   'nsi 2', 'interaction between named and slurpy (4)';
 }
 
+# RT #68234
+{
+    multi rt68234(:$key!) { 'with key' };
+    multi rt68234(*%_)    { 'unknown' };
+    is rt68234(:key), 'with key', 'can find multi method with key';
+    #?rakudo skip 'RT #68234'
+    is rt68234(:unknown), 'unknown', 'can find multi method with slurpy';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 10, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

NOM​: works correctly, checking tests...

bbkr​:nom bbkr$ ./perl6 -e 'multi foo(*%_) { say "unknown" }; foo(​:key);
foo(​:unknown)'
unknown
unknown
bbkr​:nom bbkr$ ./perl6 -e 'multi foo(​:$key!) { say "with key" }; multi
foo(*%_) { say "unknown" }; foo(​:key); foo(​:unknown)'
with key
unknown

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

Mentioned tests are already unfudged and passing.

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

@bbkr - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 11, 2011
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant