Skip Menu |
Report information
Id: 126969
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: Carl Mäsak <cmasak [...] gmail.com>
To: rakudobug [...] perl.org
Date: Sun, 20 Dec 2015 01:11:09 +0100
Subject: [BUG] Smartmatching against a regex in a variable doesn't capture things into $/ in Rakudo
Download (untitled) / with headers
text/plain 891b
<masak> m: say so "foo" ~~ /f(oo)/; say ~$0 <camelia> rakudo-moar 091ee7: OUTPUT«True␤oo␤» <masak> m: constant $R = /f(oo)/; say so "foo" ~~ $R; say ~$0 <camelia> rakudo-moar 091ee7: OUTPUT«True␤Use of Nil in string context [...] <masak> the last line not working is a regression (that I just discovered in a test in a branch in 007) <masak> is that intentional? feels to me that oughta work just fine. <lucasb> m: my \rx = /f(oo)/; say so "foo" ~~ rx; say ~$0 <camelia> rakudo-moar 091ee7: OUTPUT«True␤Use of Nil in string context [...] <lucasb> star: my \rx = /f(oo)/; say so "foo" ~~ rx; say ~$0 <camelia> star-m 2015.09: OUTPUT«True␤oo␤» <lucasb> (just showing...) <masak> well, with this one I kinda half-expect jnthn to pop up (tomorrow) and say "that's a feature!" or "masak, you submitted an RT thing that said it should be like that!" :P * masak submits rakudobug
Download (untitled) / with headers
text/plain 321b
rudi_s++ on IRC noted that in some cases (in a perl -e oneliner or on a single REPL line) it works as expected, but spread out over multiple REPL lines it does not. Also raised the question as to whether or not an explicit call to $regex.ACCEPTS should alter $/. http://irclog.perlgeek.de/perl6/2016-03-09#i_12156052
Download (untitled) / with headers
text/plain 542b
This is still broken, and it's important to me. my $target = 'abcdef'; my $n = 'abc'; my $r = rx/ ( 'abc' ) /; say "\$r is ", $r.WHAT; $r.say; # This returns a Bool my $result = $target ~~ $r; say "result is ", $result.WHAT; # This returns a Match my $result = $target ~~ rx/ ( 'abc' ) /; say "result is ", $result.WHAT; put '$r: ', $target ~~ $r ?? "Matched $0" !! 'Misssed'; put 'rx// directly: ', $target ~~ rx/ ( <$n> ) / ?? "Matched $0" !! 'Misssed'; put 'm//: ', $target ~~ m/ ( <$n> ) / ?? "Matched $0" !! 'Misssed';
RT-Send-CC: perl6-compiler [...] perl.org, brian.d.foy [...] gmail.com
Download (untitled) / with headers
text/plain 861b
On Tue, 29 Nov 2016 22:24:43 -0800, comdog wrote: Show quoted text
> This is still broken, and it's important to me. > > my $target = 'abcdef'; > > my $n = 'abc'; > my $r = rx/ ( 'abc' ) /; > say "\$r is ", $r.WHAT; > $r.say; > > # This returns a Bool > my $result = $target ~~ $r; > say "result is ", $result.WHAT; > > # This returns a Match > my $result = $target ~~ rx/ ( 'abc' ) /; > say "result is ", $result.WHAT; > > > put '$r: ', > $target ~~ $r > ?? "Matched $0" !! 'Misssed'; > > put 'rx// directly: ', > $target ~~ rx/ ( <$n> ) / > ?? "Matched $0" !! 'Misssed'; > > put 'm//: ', > $target ~~ m/ ( <$n> ) / > ?? "Matched $0" !! 'Misssed';
This was fixed as part of another dupe ticket in https://github.com/rakudo/rakudo/commit/5ac593ee098f204ea69ef57edd9ae0925c544ea4 and tests were added too. Brian, update to 2016.11 release to receive the fix.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org