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

:nth(-666) is intended to die, but it does not #4475

Closed
p6rt opened this issue Aug 15, 2015 · 9 comments
Closed

:nth(-666) is intended to die, but it does not #4475

p6rt opened this issue Aug 15, 2015 · 9 comments
Labels
JVM Related to Rakudo-JVM testcommitted

Comments

@p6rt
Copy link

p6rt commented Aug 15, 2015

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

Searchable as RT125815$

@p6rt
Copy link
Author

p6rt commented Aug 15, 2015

From @AlexDaniel

You can put any negative number (even -Inf) and it will not die​:

<AlexDaniel> m​: say 'foo foo foo'.subst(/foo/, "bar", :nth(-Inf));
<camelia> rakudo-moar ab73b0​: OUTPUT«foo foo foo␤»

However, from https://github.com/rakudo/rakudo/blob/nom/src/core/Str.pm#L606
:
fail "Attempt to retrieve negative match :nth($n)" if $n < 1;

So it seems like it does not work?

Also, it should talk about allowing only positive values because the
conditional is checking for < 1.

@p6rt
Copy link
Author

p6rt commented Nov 18, 2015

From @usev6

This seems to work now​:

$ perl6 -e 'say "foo foo foo".subst(/foo/, "bar", :nth(-Inf));'
Attempt to retrieve before :1st match -- :nth(-Inf)
  in block <unit> at -e​:1

skids++ added tests with commit e502eaf9.

For some reason a few of those tests still fail (do not die) on rakudo.jvm.

I'll flag this ticket as [JVM] and use it to fudge those failing tests.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 18, 2015

From @usev6

This seems to work now​:

$ perl6 -e 'say "foo foo foo".subst(/foo/, "bar", :nth(-Inf));'
Attempt to retrieve before :1st match -- :nth(-Inf)
  in block <unit> at -e​:1

skids++ added tests with commit e502eaf9.

For some reason a few of those tests still fail (do not die) on rakudo.jvm.

I'll flag this ticket as [JVM] and use it to fudge those failing tests.

@p6rt
Copy link
Author

p6rt commented Nov 18, 2015

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

@p6rt
Copy link
Author

p6rt commented Nov 18, 2015

From @usev6

The failing tests on JVM behave correctly, when executed on the command line​:

$ perl6-j -e 'my $data = "f fo foo fooo foooo fooooo foooooo"; $data ~~ m​:nth(-1)/fo+/; say "alive"'
Attempt to retrieve before :1st match -- :nth(-1)
  in block <unit> at -e​:1

The same code in the test file (using 'throws-like') does not die. So, maybe the problem is somewhere else.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 18, 2015

From @usev6

The failing tests on JVM behave correctly, when executed on the command line​:

$ perl6-j -e 'my $data = "f fo foo fooo foooo fooooo foooooo"; $data ~~ m​:nth(-1)/fo+/; say "alive"'
Attempt to retrieve before :1st match -- :nth(-1)
  in block <unit> at -e​:1

The same code in the test file (using 'throws-like') does not die. So, maybe the problem is somewhere else.

@p6rt
Copy link
Author

p6rt commented Oct 25, 2016

From @usev6

All the tests fudged with this ticket number are passing now​: Raku/roast@8d39a9b

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 25, 2016

From @usev6

All the tests fudged with this ticket number are passing now​: Raku/roast@8d39a9b

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Oct 25, 2016

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

@p6rt p6rt closed this as completed Oct 25, 2016
@p6rt p6rt added JVM Related to Rakudo-JVM testcommitted labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JVM Related to Rakudo-JVM testcommitted
Projects
None yet
Development

No branches or pull requests

1 participant