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

Cannot do >>+=>> on the elements of an Array in Rakudo #2169

Closed
p6rt opened this issue Sep 15, 2010 · 5 comments
Closed

Cannot do >>+=>> on the elements of an Array in Rakudo #2169

p6rt opened this issue Sep 15, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 15, 2010

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

Searchable as RT77876$

@p6rt
Copy link
Author

p6rt commented Sep 15, 2010

From @masak

<masak> rakudo​: my @​array = (3,8,2,9,3,8); @​array >>+=>> 42; say
~@​array; # via flussence++
<p6eval> rakudo 5ac20e​: OUTPUT«Cannot modify readonly value␤ in
'&infix​:<=>' [...]
<masak> <flussence> that's straight from S03...
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Oct 7, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in S03-metaops/hyper.t

commit f471cc034654ed8c47adde98d2d811d54cb3d091
Author​: Kodi Arfer <hippo@​Thoth.(none)>
Date​: Thu Oct 7 16​:07​:48 2010 -0400

  [hyper.t] Tests for RT #​77876.

Inline Patch
diff --git a/S03-metaops/hyper.t b/S03-metaops/hyper.t
index b9a2780..a949a5c 100644
--- a/S03-metaops/hyper.t
+++ b/S03-metaops/hyper.t
@@ -8,7 +8,7 @@ use Test;
 
 =end pod
 
-plan 269;
+plan 277;
 
 # L<S03/Hyper operators>
  # binary infix
@@ -705,6 +705,14 @@ my @e;
     @r = (1, 2, 3, *) «~» <A B C D E>;
     @e = <1A 2B 3C 3D 3E>;
     is ~@r, ~@e, 'dwimmy hyper extends lists ending with * by copying the last element';
+
+    @r = (1, 2, *) «~» (4, 5, *);
+    @e = <14 25>;
+    is ~@r, ~@e, 'dwimmy hyper omits * when both arguments of same length have one';
+
+    @r = (1, 2, *) «~» (4, 5, 6, *);
+    @e = <14 25 26>;
+    is ~@r, ~@e, 'dwimmy hyper takes longer length given two arguments ending with *';
 }
 
 # RT #77010
@@ -729,6 +737,32 @@ my @e;
     is ((9, 8) <<->> (1, 2, 5)), (8, 6, 4), '<<->>';
 }
 
+# RT #77876
+# L<S03/Hyper operators/'@array »+=»'>
+# Hyper assignment operators
+{
+    my @array = 3, 8, 2, 9, 3, 8;
+    @r = @array »+=« (1, 2, 3, 4, 5, 6);
+    @e = 4, 10, 5, 13, 8, 14;
+    is @r, @e, '»+=« returns the right value';
+    is @array, @e, '»+=« changes its lvalue';
+
+    @array = 3, 8, 2, 9, 3, 8;
+    @r = @array »*=» (1, 2, 3);
+    @e = 3, 16, 6, 9, 6, 24;
+    is @r, @e, '»*=» returns the right value';
+    is @array, @e, '»*=» changes its lvalue';
+
+    my $a = 'apple';
+    my $b = 'blueberry';
+    my $c = 'cherry';
+    @r = ($a, $b, $c) »~=» <pie tart>;
+    @e = <applepie blueberrytart cherrypie>;
+    is @r, @e, '»~=» with list of scalars on the left returns the right value';
+    my $e = 'applepie, blueberrytart, cherrypie';
+    is "$a, $b, $c", $e, '»~=» changes each scalar';
+}
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Oct 7, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 7, 2010

From @Kodiologist

Fixed as of 377615e.

@p6rt
Copy link
Author

p6rt commented Oct 7, 2010

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

@p6rt p6rt closed this as completed Oct 7, 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