Ticket #1668 (closed bug: fixed)
NQP: Problem with arrays when unshifting/pushing
| Reported by: | bluescreen | Owned by: | pmichaud |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | nqp | Version: | 2.3.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | Platform: | linux |
Description
The following snippet is part of actions.pm of the language I'm trying to implement,
method TOP($/,$key) {
our @?BLOCK;
our $?BLOCK;
my $past;
if $key eq 'open' {
$?BLOCK := PAST::Block.new( :blocktype('declaration'), :node( $/ ) );
$?BLOCK.symbol_defaults( :scope('package') );
say("before unshifting/shifting");
@?BLOCK.unshift($?BLOCK);
say(+@?BLOCK);
@?BLOCK.shift();
say("after unshifting/shifting" );
it compiles ok but in runtime it get the following error
before unshifting/shifting 0 ResizablePMCArray: Can't shift from an empty array!
If preload @?BLOCK with bogus data it works for example:
@?BLOCK := (1,2);
In this case it doesn't fail. In #parrot plobsing mentioned that could be a problem with autoviv.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

