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
Slurpy array 'is copy' returns incorrectly. #545
Comments
From publiustemp-perl6users@yahoo.com sub array_normal (@array) { sub array_normal_copy (@array) { sub array_slurpy (*@array) { sub array_slurpy_copy (*@array is copy) { my @array = <a b c>; my @new_array = array_normal(@array); @new_array = array_normal_copy(@array); @new_array = array_slurpy(@array); @new_array = array_slurpy_copy(@array); This outputs the following: Array has 3 elements and the first value is 'a' So the "*@array is copy" behaves like the rest when in the sub, but when returned, returns a single item. Cheers. -- |
From publiustemp-perl6users@yahoo.comForgot to add the revision and computer info: $ svn info; uname -a Darwin curtis-poes-computer-3.local 9.5.1 Darwin Kernel Version 9.5.1: Cheers, |
From @jnthnHi, OK, good news and bad. :-) Cutting down the example a tad for the
OK, so now they give the same result, thanks to fixing a bug in 'is Array has 3 elements and the first value is 'a' However, I fear we may now have a bug in slurpy. Because if you pass an Array has 1 elements and the first value is 'a b c' Thoughts? 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 b/t/spec/S06-signature/slurpy-params.t |
From @moritzWorks now as expected, tests pass. |
@moritz - Status changed from 'open' to 'resolved' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S06-signature/slurpy-params.t commit 42f8eb5b687cfa52c27468f0951a7716d1479144 [t/spec] test for RT #61772, *@a is copy messed up in Rakudo Inline Patchdiff --git a/t/spec/S06-signature/slurpy-params.t b/t/spec/S06-signature/slurpy-params.t
index 4b8e748..f5d3440 100644
--- a/t/spec/S06-signature/slurpy-params.t
+++ b/t/spec/S06-signature/slurpy-params.t
@@ -302,6 +302,16 @@ eval_dies_ok 'sub rt65324(*@x, $oops) { say $oops }',
is slurpy-by-name(:var<a v g>), 'a|v|g', 'Can call slurpy param by name';
}
+# RT #61772
+{
+ sub array_slurpy_copy(*@a is copy) {
+ return @a;
+ }
+ my @array = <a b c>;
+ my @c = array_slurpy_copy(@array);
+ is @c[0], 'a', 'slurpy is copy-array works fine, thank you';
+}
+
done_testing;
# vim: ft=perl6 |
Migrated from rt.perl.org#61772 (status was 'resolved')
Searchable as RT61772$
The text was updated successfully, but these errors were encountered: