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

Reassigning to matched-against string and then accessing submatches can lead to substr errors because of binding against the scalar container in Rakudo #3163

Closed
p6rt opened this issue Jun 12, 2013 · 3 comments

Comments

@p6rt
Copy link

p6rt commented Jun 12, 2013

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

Searchable as RT118453$

@p6rt
Copy link
Author

p6rt commented Jun 12, 2013

From @masak

<masak> ok, this is a fun one​:
<masak> rn​: my $s = 'pre x post'; $s ~~ /^ (&lt;-[x]&gt;+) 'x' (\N+) $/; $s =
~$0; say ~$1
<camelia> niecza v24-75-g480a062​: OUTPUT« post␤»
<camelia> ..rakudo b2072f​: OUTPUT«Start of substr out of range. Is​: 5,
should be in 0..4 [...]
<masak> I'm entirely with Niecza here.
<masak> I think rakudo has... a bug. :)
<masak> of course you should bind to the string itself, not to the scalar
container that holds it.
* masak submits rakudobug
<eternaleye> masak​: When you put that ellipsis in your earlier line, I
heard a scare chord.
<eternaleye> "I think rakudo has... [DUNNNN] a bug"
<eternaleye> Complete with that gif of the gopher suddenly turning to the
camera.

@p6rt
Copy link
Author

p6rt commented Oct 22, 2015

From @usev6

This works now​:

$ perl6 -e 'my $s = "pre x post"; $s ~~ /^ (&lt;-[x]&gt;+) "x" (\N+) $/; $s = ~$0; say ~$1'
post

I added a test to S05-match/capturing-contexts.t with commit Raku/roast@6a07e754c2.

I'm closing this ticket as 'resolved'.

@p6rt p6rt closed this as completed Oct 22, 2015
@p6rt
Copy link
Author

p6rt commented Oct 22, 2015

@usev6 - Status changed from 'new' to 'resolved'

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