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
Double layers of array when binding an Array in a scalar variable to an 'is copy' array variable in Rakudo #1896
Comments
From @masak<masak> rakudo: my $a = [1, 2, 3]; foo($a); bar($a); sub foo(@a) { say |
From @pmichaudNow fixed in c18d372. Assigning to moritz++ for spectest coverage. Thanks! Pm |
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 at least one of these files: t/spec/S05-match/make.t, t/spec/S06-traits/is-copy.t commit b1a01252fa1459396c9f771a5c47c335eb5e6383 [t/spec] test for RT #76242, "is copy" array parameters Inline Patchdiff --git a/t/spec/S05-match/make.t b/t/spec/S05-match/make.t
index 1a4390b..c0cda39 100644
--- a/t/spec/S05-match/make.t
+++ b/t/spec/S05-match/make.t
@@ -7,7 +7,8 @@ plan 5;
# L<S05/Bracket rationalization/reduction using the>
"4" ~~ / (\d) { make $0.sqrt } Remainder /;
-nok($/);
+nok($/, 'No match');
+#?rakudo todo '.ast of failed match (questionable)'
is($/.ast , 2);
# L<S05/Match objects/"Fortunately, when you just want to return a different">
@@ -15,7 +16,8 @@ is($/.ast , 2);
"blah foo blah" ~~ / foo # Match 'foo'
{ make 'bar' } # But pretend we matched 'bar'
/;
-ok($/);
+ok($/, 'matched');
+#?rakudo todo '$()'
is($(), 'bar');
is $/.ast, 'bar', '$/.ast';
diff --git a/t/spec/S06-traits/is-copy.t b/t/spec/S06-traits/is-copy.t
index ec6c84c..ae634e8 100644
--- a/t/spec/S06-traits/is-copy.t
+++ b/t/spec/S06-traits/is-copy.t
@@ -4,7 +4,7 @@ use Test;
# L<S06/"Parameter traits"/"=item is copy">
# should be moved with other subroutine tests?
-plan 16;
+plan 17;
{
sub foo($a is copy) {
@@ -61,4 +61,16 @@ plan 16;
is(%test<x>, 1, '...and original is unmodified.');
}
+# RT #76242
+{
+ sub t(@a is copy) {
+ my $x = 0;
+ $x++ for @a;
+ $x;
+ }
+
+ my $a = [1, 2, 3];
+ is t($a), 3, 'passing [1,2,3] to @a is copy does results in three array items';
+}
+
# vim: ft=perl6 |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#76242 (status was 'resolved')
Searchable as RT76242$
The text was updated successfully, but these errors were encountered: