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

Slipping an empty list into an infinite repetition, causes "Cannot shift from an empty Array" #6028

Closed
p6rt opened this issue Jan 22, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 22, 2017

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

Searchable as RT130619$

@p6rt
Copy link
Author

p6rt commented Jan 22, 2017

From @smls

  ➜ say (|() xx *)[0];
  Cannot shift from an empty Array
  in block <unit> at <unknown file> line 1

Obviously, this golfed-down example is not useful as written. But this
happened as an edge case of some real code I was writing.

By contrast, when the `xx` repetition count is finite is works correctly​:

  ➜ say (|() xx 5)[0];
  Nil

And when the thing that is being slipped in is non-empty, it also work
correctly​:

  ➜ say (|1 xx *)[0];
  1

@p6rt
Copy link
Author

p6rt commented Jan 22, 2017

From @zoffixznet

On Sun, 22 Jan 2017 09​:43​:51 -0800, smls75@​gmail.com wrote​:

➜  say \(|\(\) xx \*\)\[0\];
Cannot shift from an empty Array
  in block \<unit> at \<unknown file> line 1

Obviously, this golfed-down example is not useful as written. But this
happened as an edge case of some real code I was writing.

By contrast, when the `xx` repetition count is finite is works correctly​:

➜  say \(|\(\) xx 5\)\[0\];
Nil

And when the thing that is being slipped in is non-empty, it also work
correctly​:

➜  say \(|1 xx \*\)\[0\];
1

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@4e49ec135d
Test​: Raku/roast@75e15bbb2a

@p6rt
Copy link
Author

p6rt commented Jan 22, 2017

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

@p6rt
Copy link
Author

p6rt commented Jan 22, 2017

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

@p6rt p6rt closed this as completed Jan 22, 2017
@p6rt p6rt added the Bug 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
Development

No branches or pull requests

1 participant