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

.[+*] seems to be incorrect #1131

Closed
p6rt opened this issue Jul 11, 2009 · 5 comments
Closed

.[+*] seems to be incorrect #1131

p6rt opened this issue Jul 11, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 11, 2009

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

Searchable as RT67450$

@p6rt
Copy link
Author

p6rt commented Jul 11, 2009

From @finanalyst

perl6

my @​x=1,2,3,4; my @​z; for @​x { @​z[+*] = $_ }; @​z.perl.say
[4]
my @​x=1,2,3,4; my @​z; for @​x { @​z[+@​z] = $_ }; @​z.perl.say
[1,2,3,4]

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

From @pmichaud

On Sat Jul 11 06​:57​:11 2009, richardh wrote​:

perl6

my @​x=1,2,3,4; my @​z; for @​x { @​z[+*] = $_ }; @​z.perl.say
[4]
my @​x=1,2,3,4; my @​z; for @​x { @​z[+@​z] = $_ }; @​z.perl.say
[1,2,3,4]

Now fixed in f48920, thanks!

  $ ./perl6
  > my @​x = 1,2,3,4; my @​z; for @​x { @​z[+*] = $_ }; @​z.perl.say
  [1, 2, 3, 4]

We need verification of a spectest in order to close this ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 11, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/whatever.t

commit f393f9c5b8f153e317cc29d4f072fce98dd053a0
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Aug 11 21​:44​:34 2009 +0000

  [t/spec] test for RT #​67450 - +* as array index
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27963 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/whatever.t b/t/spec/S02-builtin_data_types/whatever.t
index 3e1766c..ec46f9c 100644
--- a/t/spec/S02-builtin_data_types/whatever.t
+++ b/t/spec/S02-builtin_data_types/whatever.t
@@ -1,7 +1,7 @@
 use v6;
 use Test;
 
-plan 16;
+plan 17;
 
 # L<S02/Built-In Data Types/"The * character as a standalone term captures the notion of">
 # L<S02/Native types/"If any native type is explicitly initialized to">
@@ -58,6 +58,14 @@ is @a, [1,2,3,4], '*.meth created closure works';
     # and here are two actual applications of +*
     is sort($x, @list), [1,2,3,10], '+* generates closure to numify';
     is @list.sort($x), [1,2,3,10], '+* generates closure to numify';
+
+    # test that  +* works in a slice
+    my @x1;
+    for 1..4 {
+        @x1[+*] = $_;
+    }
+    is @x1.join('|'), '1|2|3|4', '+* in hash slice (RT 67450)';
 }
 
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 11, 2009

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

@p6rt p6rt closed this as completed Aug 11, 2009
@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