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
An if-block confuses &?ROUTINE to point at the wrong outer routine #6065
Comments
From @moritzsub f($x) { This prints f on Rakudo 2017.01-170-gc0a907f built on MoarVM version &?ROUTINE should refer to the inner, anonymous subroutine here, not to -- |
From @moritzTest added here: Raku/roast@ce7fb0f723 commit ce7fb0f72346dbe6da1629b5af978b9c97d31e4d RT #130761: if-block confuses &?ROUTINE Inline Patchdiff --git a/S02-magicals/sub.t b/S02-magicals/sub.t
index 417df28..7021230 100644
--- a/S02-magicals/sub.t
+++ b/S02-magicals/sub.t
@@ -8,7 +8,7 @@ This tests the &?ROUTINE magical value
=end comment
-plan 10;
+plan 11;
# L<S06/The C<&?ROUTINE> object>
# L<S02/Names/Which routine am I in>
@@ -69,4 +69,18 @@ is($result3, 6, 'the &?ROUTINE magical works correctly in overloaded operators'
is @collected.join(''), 'aaaa', 'Correct closure semantics with &?ROUTINE in nested closure';
}
+# RT #130761
+
+{
+ sub f() {
+ sub g() {
+ if True {
+ return &?ROUTINE.name;
+ }
+ }
+ }
+ #?rakudo todo 'RT #130761'
+ is f()(), 'g', 'Inner blocks are transparent to &?ROUTINE (RT#130761)';
+}
+
# vim: ft=perl6 |
From @zoffixznetOn Sat, 11 Feb 2017 03:29:18 -0800, moritz wrote:
Seems an optimizer bug. Goes away if you switch it off: $ perl6 --optimize=3 -e 'sub f($x) { sub y { if True { say &?ROUTINE.name } } }.(42)()' |
The RT System itself - Status changed from 'new' to 'open' |
From @usev6Just for the record: This seems to work on the JVM backend: $ ./perl6-j --optimize=3 -e 'sub f() { sub g() { if True { return &?ROUTINE.name } } }; say f()()' I'm going to unfudge the test in S02-magicals/sub.t for rakudo.jvm. |
1 similar comment
From @usev6Just for the record: This seems to work on the JVM backend: $ ./perl6-j --optimize=3 -e 'sub f() { sub g() { if True { return &?ROUTINE.name } } }; say f()()' I'm going to unfudge the test in S02-magicals/sub.t for rakudo.jvm. |
From @usev6On Thu, 04 Apr 2019 22:59:38 -0700, bartolin@gmx.de wrote:
For the record: Raku/roast@aaf7ad02fc |
Migrated from rt.perl.org#130761 (status was 'open')
Searchable as RT130761$
The text was updated successfully, but these errors were encountered: