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

Undefined interpolated values in regexes wrongly match in Rakudo #2493

Closed
p6rt opened this issue Oct 1, 2011 · 5 comments
Closed

Undefined interpolated values in regexes wrongly match in Rakudo #2493

p6rt opened this issue Oct 1, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 1, 2011

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

Searchable as RT100472$

@p6rt
Copy link
Author

p6rt commented Oct 1, 2011

From @masak

<moritz> nom​: say 'aa' ~~ /(.)$1/
<p6eval> nom ebd4d8​: OUTPUT«=> <a>␤ 0 => <a>␤␤»
<moritz> this... shouldn't match
<moritz> nom​: my $a; say so 'aaa' ~~ /$a/
<p6eval> nom ebd4d8​: OUTPUT«Use of uninitialized value in string
context␤Use of uninitialized value in string context␤Bool​::True␤»
<moritz> RONG
* masak submits rakudobug

I guess the correct behavior of an undefined interpolated value is
simply to always fail that part of the match.

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

From @jnthn

On Sat Oct 01 02​:51​:01 2011, masak wrote​:

<moritz> nom​: say 'aa' ~~ /(.)$1/
<p6eval> nom ebd4d8​: OUTPUT«=> <a>␤ 0 => <a>␤␤»
<moritz> this... shouldn't match
<moritz> nom​: my $a; say so 'aaa' ~~ /$a/
<p6eval> nom ebd4d8​: OUTPUT«Use of uninitialized value in string
context␤Use of uninitialized value in string context␤Bool​::True␤»
<moritz> RONG
* masak submits rakudobug

I guess the correct behavior of an undefined interpolated value is
simply to always fail that part of the match.

Now​:

say so 'aa' ~~ /(.)$1/
Bool​::False
my $a; say so 'aaa' ~~ /$a/
Bool​::False

Note that we can catch the first one at compile time in the future, but
failing to match satisfies this ticket.

Tests needed.

/jnthn

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 7, 2013

From @FROGGS

<FROGGS> r​: say 'aa' ~~ /(.)$1/
<p6eval> ..rakudo 4fb07b​: OUTPUT«#<failed match>␤»
<FROGGS> r​: say 'aa' ~~ /(.)$0/
<p6eval> rakudo 4fb07b, niecza v24-19-g5f89e5f​: OUTPUT«「aa」␤ 0 => 「a」␤␤»

Test​: https://github.com/perl6/roast/blob/master/S05-mass/rx.t#L2950

@p6rt
Copy link
Author

p6rt commented Feb 7, 2013

@FROGGS - Status changed from 'open' 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