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
Comments
From @masak<masak> rakudo: my @array = (3,8,2,9,3,8); @array >>+=>> 42; say |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in S03-metaops/hyper.t commit f471cc034654ed8c47adde98d2d811d54cb3d091 [hyper.t] Tests for RT #77876. Inline Patchdiff --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 |
The RT System itself - Status changed from 'new' to 'open' |
From @KodiologistFixed as of 377615e. |
@Kodiologist - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#77876 (status was 'resolved')
Searchable as RT77876$
The text was updated successfully, but these errors were encountered: