Skip Menu |
Report information
Id: 78276
Status: open
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)



Subject: [BUG] Null PMC access when calling a multi sub with a parameter narrowed by a subtype that does a regex match in Rakudo
Date: Thu, 7 Oct 2010 22:27:15 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
<masak> rakudo: subset Greeting of Str where { /:i ^oh \s+ \w+ '!'?$/ }; subset LolGreeting of Str where { .words[1].lc eq 'hai' }; multi detect(Str) { "not a greeting" }; multi detect(Greeting) { "regular greeting" }; multi detect(LolGreeting) { "lol-greeting" }; say detect "OH HAI" <p6eval> rakudo e9e7fc: OUTPUT«Null PMC access in isa_pmc() [....] * masak submits rakudobug <ash_> rakudo: say 'foo' ~~ /:i foo/; <p6eval> rakudo e9e7fc: OUTPUT«foo␤» <masak> ash_: it's to do with multies, and subtypes. <ash_> got ya <masak> rakudo: subset G of Str where { /O/ }; sub detect(G) {}; detect "O" <p6eval> rakudo e9e7fc: OUTPUT«Method 'match' not found for invocant of class ' [...] <masak> rakudo: subset G of Str where { /O/ }; multi detect(G) {}; detect "O" <p6eval> rakudo e9e7fc: OUTPUT«Null PMC access in isa_pmc()␤ in '&infix:<=>' at line 1␤ in 'Regex::Bool' at line 5970:CORE.setting␤ in 'detect' [...] <masak> rakudo: subset G of Str where { .chars > 0 }; multi detect(G) {}; detect "O"; say "alive" <p6eval> rakudo e9e7fc: OUTPUT«alive␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 594b
<tylercurtis> rakudo: multi detect(Str $foo where { /O/ }) {}; detect "O" <p6eval> rakudo 377615: OUTPUT«Null PMC access in isa_pmc() [...] <tylercurtis> rakudo: multi detect(Str $foo where /O/) {say 'hi'}; detect "O" <p6eval> rakudo 377615: OUTPUT«hi␤» * masak adds this to the ticket <masak> tylercurtis++ <masak> rakudo: subset G of Str where /O/; multi detect(G) {}; detect "O"; say "alive" <p6eval> rakudo 377615: OUTPUT«alive␤» <tylercurtis> rakudo: multi detect(Str $foo where { m/O/ } ) {say 'hi'}; detect "O" <p6eval> rakudo 377615: OUTPUT«hi␤» <masak> another clue. nice!
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 710b
<masak> r: sub detect(Str $foo where { /O/ }) {}; detect "O" <p6eval> rakudo 34e8d4: OUTPUT«No such method 'match' for invocant of type 'Any' [...] <jnthn> Oh...is that a sink context oopsie? <masak> r: subset Ostring of Str where { /O/ }; say "O" ~~ Ostring <p6eval> rakudo 34e8d4: OUTPUT«No such method 'match' for invocant of type 'Any' [...] <masak> seems so. <jnthn> Not surprising given we don't really do sink context properly yet. <jnthn> A curious place for it to fall out though * masak updates the ticket <masak> r: say "O" ~~ { /O/ } <p6eval> rakudo 34e8d4: OUTPUT«␤» <moritz> I guess the problem is that at the point where the regex is evaluated in boolean context, $_ isn't bound to 'O'
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 457b
The original code works now 12:09 <diakopter> m: subset Greeting of Str where { /:i ^oh \s+ \w+ '!'?$/ }; subset LolGreeting of Str where { .words[1].lc eq 'hai' }; multi detect(Str) { "not a greeting" }; multi detect(Greeting) { "regular greeting" }; multi detect(LolGreeting) { "lol-greeting" }; say detect "OH HAI" 12:09 <camelia> rakudo-moar 61d231: OUTPUT«lol-greeting␤»


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