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

List assignment to "is copy" parameters with value 0 doesn't work #1980

Closed
p6rt opened this issue Jul 29, 2010 · 6 comments
Closed

List assignment to "is copy" parameters with value 0 doesn't work #1980

p6rt opened this issue Jul 29, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jul 29, 2010

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

Searchable as RT76804$

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

From @Kodiologist

#perl6 on 29 July 2010​:

<Kodi> rakudo​: sub f($a is copy = 1) { my $b; ($a, $b) = (1, 2);
  say $a; }; f
<p6eval> rakudo 9fd5ea​: OUTPUT«1␤»
<Kodi> rakudo​: sub f($a is copy = 0) { my $b; ($a, $b) = (1, 2);
  say $a; }; f
<p6eval> rakudo 9fd5ea​: OUTPUT«1 2␤»
<Kodi> Known?
<moritz_> Kodi​: don't think so
<Kodi> moritz_​: Okay, I'll file a rakudobug.

It turns out that the bug has more to do with the value 0
than with default values​:

./perl6 -e 'sub f($a is copy) { my $b; ($a, $b) = (1, 2); say $a; }; f(1)'
1
./perl6 -e 'sub f($a is copy) { my $b; ($a, $b) = (1, 2); say $a; }; f(0)'
1 2

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in at least one of these files​: t/spec/S03-operators/assign.t, t/spec/S06-traits/is-copy.t

commit 6a51dccb70a504c421a1de0c62c532aa86c6fb8f
Author​: Kodi <Kodi@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Thu Jul 29 21​:21​:26 2010 +0000

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

Inline Patch
diff --git a/t/spec/S03-operators/assign.t b/t/spec/S03-operators/assign.t
index cbd6850..08056c5 100644
--- a/t/spec/S03-operators/assign.t
+++ b/t/spec/S03-operators/assign.t
@@ -556,7 +556,7 @@ sub l () { 1, 2 };
 #?rakudo skip '$a[] autovivification (unspecced?)'
 {
     my $a;
-    $a[] = l, l, l
+    $a[] = l, l, l;
     is($a.elems, 6, 'lhs treats $a[] as list');
 }
 
diff --git a/t/spec/S06-traits/is-copy.t b/t/spec/S06-traits/is-copy.t
index ae634e8..581f357 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 17;
+plan 19;
 
 {
   sub foo($a is copy) {
@@ -73,4 +73,17 @@ plan 17;
     is t($a), 3, 'passing [1,2,3] to @a is copy does results in three array items';
 }
 
+# RT #76804
+#?rakudo skip 'RT 76804'
+{
+    sub f($arg is copy) {
+        my $other;
+        ($arg, $other) = 5, 6;
+        $arg;
+    };
+    is f(0), 5, 'list assignment (0)';
+    is f(1), 5, 'list assignment (1)';
+}
+
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jul 4, 2011

From @moritz

Fixed in nom, this ticket can be closed when nom becomes master.

@p6rt
Copy link
Author

p6rt commented Nov 30, 2011

From @coke

On Mon Jul 04 01​:53​:43 2011, moritz wrote​:

Fixed in nom, this ticket can be closed when nom becomes master.

\o/

Closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Nov 30, 2011

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

@p6rt p6rt closed this as completed Nov 30, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant