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

)> in regex results in stuff being matched wrongly ( /)> . <(/ ) #6220

Open
p6rt opened this issue May 2, 2017 · 5 comments
Open

)> in regex results in stuff being matched wrongly ( /)> . <(/ ) #6220

p6rt opened this issue May 2, 2017 · 5 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented May 2, 2017

Migrated from rt.perl.org#131247 (status was 'open')

Searchable as RT131247$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented May 2, 2017

From @AlexDaniel

Code​:
say "abc" ~~ /)> . <(/

Result (2015.12 … 2017.03)​:
#<failed match>

Result (2017.04.3, HEAD(701dab3))
「bc」

「bc」 is definitely wrong and #<failed match> is kinda right.

Bisectable points to these two commits​:
* rakudo/rakudo@5d68f1f
* rakudo/rakudo@3cff74c

IRC log​: https://irclog.perlgeek.de/perl6-dev/2017-05-02#i_14521403

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented May 4, 2017

From @jnthn

On Tue, 02 May 2017 14​:51​:47 -0700, alex.jakimenko@​gmail.com wrote​:

Code​:
say "abc" ~~ /)> . <(/

Result (2015.12 … 2017.03)​:
#<failed match>

Result (2017.04.3, HEAD(701dab3))
「bc」

「bc」 is definitely wrong and #<failed match> is kinda right.

Bisectable points to these two commits​:
*
rakudo/rakudo@5d68f1f
*
rakudo/rakudo@3cff74c

IRC log​: https://irclog.perlgeek.de/perl6-dev/2017-05-02#i_14521403

Given it can never match, a compile-time error might be the best solution.

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented May 4, 2017

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

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented May 19, 2017

From @zoffixznet

Another case that might benefit from being complained about with an error. Only the last capture is used​:

<Zoffix__> star​: use Test; is-deeply ~('123456789foobarMEOWS'~~ /<(fo)> o <( ba)> r/), 'foba', 'case 3';
<camelia> star-m 2016.10​: OUTPUT​: «not ok 1 - case 3␤␤# Failed test 'case 3'␤# at <tmp> line 1␤# expected​: "foba"␤# got​: "ba"␤»

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Sep 17, 2017

From @moritz

Just as a historical perspective, failed matches used to be Match objects where .from > .to, and iirc NQP still does it that way. When funny placement of )> and <( tricks the regex engine into such cases.

Maybe a sane-ish approach would be to change <( to only ever increase .from, and )> to only decrease .to.

A static compile-time error would be nice too, but I guess it won't be able to capture all cases, like when <( and )> are only used in some branches of an a conjunction or disjunction.

@p6rt p6rt added the regression 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
1 participant
You can’t perform that action at this time.