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
return value of multi declaration should be just one candidate. #1766
Comments
From lewis@wall.orgWhen I run: multi x (Int $x) {...} It outputs: (note there are two x's). The declaration of the second multi is returning |
From @jnthnOn Sun May 16 21:11:42 2010, lewis@wall.org wrote:
This was fixed recently (by pmichaud++ I believe) and it now outputs Thanks, Jonathan |
The RT System itself - Status changed from 'new' to 'open' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S06-multi/syntax.t commit 17f12a34c378a536e8e9a816a149785bfd2bb5b6 [t/spec] tests for RT #75136: declaring a multi just returns the current candidate, not the whole set Inline Patchdiff --git a/t/spec/S06-multi/syntax.t b/t/spec/S06-multi/syntax.t
index fd21d07..6f9a55e 100644
--- a/t/spec/S06-multi/syntax.t
+++ b/t/spec/S06-multi/syntax.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 34;
+plan *;
# L<S06/Routine modifiers/>
# L<S06/Parameters and arguments/>
@@ -114,6 +114,20 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
is 21.$m(), 42, 'can write anonymous methods inside multi subs';
}
+
+# RT #75136
+# a multi declaration should only return the current candidate, not the whole
+# set of candidates.
+{
+ multi sub koala(Int $x) { 42 * $x };
+
+ my $x = multi sub koala(Str $x) { 42 ~ $x }
+ is $x.candidates.elems,
+ 1, 'multi sub declaration returns just the current candidate';
+ is $x('moep'), '42moep', 'and that candidate works';
+ dies_ok { $x(23) }, '... and does not contain the full multiness';
+}
+
done_testing;
# vim: ft=perl6 |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#75136 (status was 'resolved')
Searchable as RT75136$
The text was updated successfully, but these errors were encountered: