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
Unhelpful error messages instead of DWIM when doing &&= or ?&= or ?|= or ?^= on an undefined variable in the rhs in Rakudo #2167
Comments
From @masak<thundergnat> std: my $x; $x &&= 1; say $x; |
From @pmichaudNow fixed in 358d728. This fix also provides the reduction [?&], [?|], Assigning to moritz++ for spectest coverage. Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzBasic tests added to S03-operators/short-circuit.t. 19:52 < moritz_> rakudo: my $x; $x &&= 5; say $x I'm glad I haven't lost my sanity over it :-) |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in S03-operators/short-circuit.t commit 519bef8c25fae4227ae9676f84da410b39291357 some basic tests for RT #77864, &&=, ||= etc. One of them fails Inline Patchdiff --git a/S03-operators/short-circuit.t b/S03-operators/short-circuit.t
index 87d0254..a6388ef 100644
--- a/S03-operators/short-circuit.t
+++ b/S03-operators/short-circuit.t
@@ -14,7 +14,7 @@ it is closely related to || and && and //.
# test cases by Andrew Savige
-plan 37;
+plan 39;
{
my $x = 1;
@@ -174,6 +174,17 @@ plan 37;
# a rakudo regression
ok (0 || 0 || 1), '0 || 0 || 1 is true';
+# RT #77864
+{
+ my $x;
+ $x &&= 5;
+ #?rakudo todo '77864'
+ nok $x.defined, '&&= leaves var on the right undefined';
+ my $y ||= 'moin';
+ is $y, 'moin', '||= on a fresh variable works';
+
+}
+
done_testing;
# vim: ft=perl6 |
From @pmichaudOn Sat Sep 18 10:55:52 2010, moritz wrote:
Rakudo is correct here -- see S03:3979: "If you apply an assignment operator to a container containing a The identity value for [&&] is True, so Rakudo has this correct. By way of comparison, consider: "my $x; $x *= 5;" which leaves $x Pm |
From @pmichaudUpdated test to match spec, resolving ticket. Pm |
@pmichaud - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#77864 (status was 'resolved')
Searchable as RT77864$
The text was updated successfully, but these errors were encountered: