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
Bogus redeclaration error when doing list assignment in an argument in Rakudo #1927
Comments
From @masak<jnthn> rakudo: sub foo(*@x) { say @x.elems }; my @a = 1,2,3; foo(@a); |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in at least one of these files: t/spec/S02-literals/listquote.t, t/spec/S06-signature/defaults.t commit e0c07d6f4b4b5f2296d16dc663070bacb38cc5de [t/spec] test for RT #76452, list assignment in function call Inline Patchdiff --git a/t/spec/S02-literals/listquote.t b/t/spec/S02-literals/listquote.t
index abe1017..afe3421 100644
--- a/t/spec/S02-literals/listquote.t
+++ b/t/spec/S02-literals/listquote.t
@@ -92,6 +92,16 @@ eval_dies_ok '<STDIN>', '<STDIN> is disallowed';
isa_ok @a[4], Num, '< ... 1.2e1 ...> is a Num';
}
+# probably doesn't really belong here, but I don't know where else to put it
+# :( --moritz
+
+# RT #76452
+#?rakudo skip 'RT 76452'
+{
+ sub f($x) { $x[0] };
+ is f(my @x = (1, 2, 3)), 1, 'function call with assignment to list';
+}
+
done_testing();
# vim: ft=perl6
diff --git a/t/spec/S06-signature/defaults.t b/t/spec/S06-signature/defaults.t
index 989a761..d83d80c 100644
--- a/t/spec/S06-signature/defaults.t
+++ b/t/spec/S06-signature/defaults.t
@@ -10,7 +10,7 @@ Tests assigning default values to variables of type code in sub definitions.
# L<S06/Optional parameters/Default values can be calculated at run-time>
-plan 3;
+plan 4;
sub doubler($x) { return 2 * $x }
@@ -31,7 +31,14 @@ package MyPack {
}
-
ok((MyPack::val_v), "default sub called in package namespace");
+
+{
+ sub default_with_list($x = (1, 2)) {
+ $x[0];
+ }
+ is default_with_list(), 1, 'can have a parcel literal as default value';
+}
+
# vim: ft=perl6 |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzworks now, and tested in t/spec/S04-declarations/my.t |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#76452 (status was 'resolved')
Searchable as RT76452$
The text was updated successfully, but these errors were encountered: