Skip to content
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

NULL PMC on unmatched or non existent named capture #2458

Closed
p6rt opened this issue Aug 6, 2011 · 8 comments
Closed

NULL PMC on unmatched or non existent named capture #2458

p6rt opened this issue Aug 6, 2011 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Aug 6, 2011

Migrated from rt.perl.org#96424 (status was 'resolved')

Searchable as RT96424$

@p6rt
Copy link
Author

p6rt commented Aug 6, 2011

From @ronaldxs

There are similar bug reports but I thought this looked different enough ...

.\perl6 -e "my $m = '3' ~~ /<digit>|<alpha>/; unless $m<alpha> { say 'at least its false'}; say $m<alpha>.perl"
at least its false
Null PMC access in find_method('perl')
  in<anon> at line 1317​:src\gen\core.pm
  in 'Any​::join' at line 1​:src\metamodel\RoleToInstanceApplier.nqp
  in 'Mu​::attribs' at line 1318​:src\gen\core.pm
  in 'Mu​::perl' at line 1322​:src\gen\core.pm
  in main program body at line 1

In the example above if you use $m<digit> instead of $m<alpha> things
work as expected but if you pick a non-existent rule name, say
$m<alphax>, you get pretty much the same output as above.

Ron

@p6rt
Copy link
Author

p6rt commented Aug 7, 2011

From @ronaldxs

Seems at least partially fixed in nom but still may be related concerns
like

nom​: my $m = '34' ~~ /<digit>+|<alpha>+/; say $m<alpha>.perl; say
Nil.perl; my $x = $m<alpha> // 4; say 'x is ', $x
nom​: OUTPUT«()␤Nil␤x is ␤»

See http://irclog.perlgeek.de/perl6/2011-08-07#i_4239512

1 similar comment
@p6rt
Copy link
Author

p6rt commented Aug 7, 2011

From @ronaldxs

Seems at least partially fixed in nom but still may be related concerns
like

nom​: my $m = '34' ~~ /<digit>+|<alpha>+/; say $m<alpha>.perl; say
Nil.perl; my $x = $m<alpha> // 4; say 'x is ', $x
nom​: OUTPUT«()␤Nil␤x is ␤»

See http://irclog.perlgeek.de/perl6/2011-08-07#i_4239512

@p6rt
Copy link
Author

p6rt commented Aug 7, 2011

@ronaldxs - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 7, 2011

From @pmichaud

On Sun Aug 07 12​:25​:15 2011, ronaldxs wrote​:

Seems at least partially fixed in nom but still may be related
concerns
like

nom​: my $m = '34' ~~ /<digit>+|<alpha>+/; say $m<alpha>.perl; say
Nil.perl; my $x = $m<alpha> // 4; say 'x is ', $x
nom​: OUTPUT«()␤Nil␤x is ␤»

See http://irclog.perlgeek.de/perl6/2011-08-07#i_4239512

Since <alpha> is quantified here, it's guaranteed to be a (possibly
empty) Array in the match object -- so nom has this one correct.

In the non-quantified case, nom is currently returning "Any", which
seems reasonable​:

  21​:00 <pmichaud> nom​: my $m = '34' ~~ /<digit>|<alpha>/; say
$m<alpha>.perl
  21​:00 <p6eval> nom​: OUTPUT«Any␤»

I'll likely close this ticket when nom becomes master, unless there's
something wrong with my analysis above.

Pm

@p6rt
Copy link
Author

p6rt commented Oct 7, 2011

From @coke

On Sun Aug 07 14​:03​:47 2011, pmichaud wrote​:

On Sun Aug 07 12​:25​:15 2011, ronaldxs wrote​:

I'll likely close this ticket when nom becomes master, unless there's
something wrong with my analysis above.

Pm

Then is now; just needs tests.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 7, 2011

From @moritz

now tested in t/spec/S05-capture/subrule.t

@p6rt
Copy link
Author

p6rt commented Oct 7, 2011

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Oct 7, 2011
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant