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 an array inside a signature produces a double array in Rakudo #1687

Closed
p6rt opened this issue Apr 13, 2010 · 7 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 13, 2010

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

Searchable as RT74336$

@p6rt
Copy link
Author

p6rt commented Feb 20, 2010

From tim.bollman@live.com

This is on the latest rakudo.

my $a; my @​b; ($a, @​b) = <1 2 3>; say @​b.perl
[["2", "3"]]

Should be ["2", "3"]

Small discussion of this can be found on #perl6 at 04​:26 UTC on Feb 20. Alpha has the correct behavior.

Thanks,
Tim Bollman
 
_________________________________________________________________
Hotmail​: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/201469228/direct/01/

@p6rt
Copy link
Author

p6rt commented Apr 13, 2010

From @masak

<masak> rakudo​: my @​a = 1,2,3; my (@​c) = @​a; say @​c.perl
<p6eval> rakudo cb4521​: OUTPUT«[[1, 2, 3]]␤»
<masak> alpha​: my @​a = 1,2,3; my (@​c) = @​a; say @​c.perl
<p6eval> alpha 30e0ed​: OUTPUT«[1, 2, 3]␤»
<masak> rakudo​: my @​a = 1,2,3; my @​c = @​a; say @​c.perl
<p6eval> rakudo cb4521​: OUTPUT«[1, 2, 3]␤»
* masak submits rakudobug
* masak wonders if this is related to the issue with double arrays in attributes

@p6rt
Copy link
Author

p6rt commented Apr 20, 2010

From @finanalyst

The syntax my ($x,@​f) generates a two dimensional array in @​f.

Alpha produces what I would expect. Rakudo doesnt.

If the current version of rakudo is correct, then how to specify a
single dimensional array?

From #perl6 April 20 9.15

finanalyst​: alpha​: $_="a\tb\tc"; my ($k,@​f) = map { .trim },
.split("\t"); @​f.perl.say;$k.say
p6eval​: alpha 30e0ed​: OUTPUT«["b", "c"]␤a␤»
<snip lines with typos>
finanalyst​: rakudo​: $_="a\tb\tc"; my ($k,@​f) = map { .trim },
.split("\t"); @​f.perl.say;$k.say
p6eval​: rakudo b05155​: OUTPUT«[["b", "c"]]␤a␤»

my ($k,@​f) appears to be the correct syntax. See below

finanalyst​: rakudo​: $_="a\tb\tc"; my $k,@​f = map { .trim },
.split("\t"); @​f.perl.say;$k.say
p6eval​: rakudo b05155​: OUTPUT«Symbol '@​f' not predeclared in
<anonymous>␤current instr.​: 'perl6;PCT;HLLCompiler;panic' pc 152
(compilers/pct/src/PCT/HLLCompiler.pir​:108)␤»

@p6rt
Copy link
Author

p6rt commented May 30, 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/S02-names_and_variables/signature.t, t/spec/S06-signature/passing-arrays.t

commit b43d5859691e04a410a5a72af5d363612a967c9f
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun May 30 20​:40​:07 2010 +0000

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

Inline Patch
diff --git a/t/spec/S02-names_and_variables/signature.t b/t/spec/S02-names_and_variables/signature.t
index 6f263a2..ca74e07 100644
--- a/t/spec/S02-names_and_variables/signature.t
+++ b/t/spec/S02-names_and_variables/signature.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 11;
+plan 12;
 
 # The :() form constructs signatures similar to how \() constructs Captures.
 # A subroutine's .signature is a Siglist object.
@@ -75,4 +75,13 @@ plan 11;
         "a subroutine's siglist can be accessed via .signature (3)";
 }
 
+{
+    my @a = 1,2,3;
+    my (@c) = @a;
+    my $i = 0;
+    $i++ for @c;
+    #?rakudo todo 'RT 74336'
+    is $i, 3, 'asigning to an array in a signature is sane';
+}
+
 # vim: ft=perl6
diff --git a/t/spec/S06-signature/passing-arrays.t b/t/spec/S06-signature/passing-arrays.t
index d76471b..95c7a3f 100644
--- a/t/spec/S06-signature/passing-arrays.t
+++ b/t/spec/S06-signature/passing-arrays.t
@@ -14,6 +14,7 @@ plan 11;
     }
 
     is count([1, 2, 3, 4]),       4, 'count([1, 2, 3, 4])';
+    #?rakudo skip 'bogus error message'
     is count(my @b = 1, 2, 3, 4), 4, 'count(my @b = 1, 2, 3)';
     is count((1, 2, 3)),          3, 'count((1, 2, 3))';
 

@p6rt
Copy link
Author

p6rt commented May 30, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 26, 2010

From @moritz

jnthn++ fixed this, test now passes.

@p6rt
Copy link
Author

p6rt commented Jun 26, 2010

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

@p6rt p6rt closed this as completed Jun 26, 2010
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant