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

bogus range o ** { 1..0 } succeeds #6121

Closed
p6rt opened this issue Mar 4, 2017 · 5 comments
Closed

bogus range o ** { 1..0 } succeeds #6121

p6rt opened this issue Mar 4, 2017 · 5 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Mar 4, 2017

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

Searchable as RT130911$

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 4, 2017

From @LLFourn

my $i = 0;
say "ooo" ~~ / "o" ** {1..$i} / #-> 「ooo」

It is impossible to match "one or more up to a maximum of zero" times. This
should just fail to match. If you do a literal '1' without it does the
right thing​:

perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /'

===SORRY!=== Error while compiling -e
Empty range

LL

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 21, 2017

From @FCO

Em Sat, 04 Mar 2017 01​:09​:20 -0800, lloyd.fourn@​gmail.com escreveu​:

my $i = 0;
say "ooo" ~~ / "o" ** {1..$i} / #-> 「ooo」

It is impossible to match "one or more up to a maximum of zero" times. This
should just fail to match. If you do a literal '1' without it does the
right thing​:

perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /'

===SORRY!=== Error while compiling -e
Empty range

LL

even with literal 0, but inside of {} it doesn't work​:

$ ./perl6 -e 'say "ooo" ~~ / "o" ** {1..1} /'
「o」
$ ./perl6 -e 'say "ooo" ~~ / "o" ** {1..0} /'
「ooo」
$ ./perl6 -e 'say "ooo" ~~ / "o" ** 1..0 /'
===SORRY!=== Error while compiling -e
Empty range
at -e​:1
------> say "ooo" ~~ / "o" ** 1..0 /

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 21, 2017

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

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 1, 2017

From @zoffixznet

On Sat, 04 Mar 2017 01​:09​:20 -0800, lloyd.fourn@​gmail.com wrote​:

my $i = 0;
say "ooo" ~~ / "o" ** {1..$i} / #-> 「ooo」

It is impossible to match "one or more up to a maximum of zero" times. This
should just fail to match. If you do a literal '1' without it does the
right thing​:

perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /'

===SORRY!=== Error while compiling -e
Empty range

LL

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@681d6be
Test​: Raku/roast@99c822a

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 1, 2017

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

Loading

@p6rt p6rt closed this Oct 1, 2017
@p6rt p6rt added the regex label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant