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

list assignment from split fails #483

Closed
p6rt opened this issue Dec 13, 2008 · 3 comments
Closed

list assignment from split fails #483

p6rt opened this issue Dec 13, 2008 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 13, 2008

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

Searchable as RT61336$

@p6rt
Copy link
Author

p6rt commented Dec 13, 2008

From @jeffhorwitz

if split() returns fewer elements than the list assignment expects (a
valid condition), it crashes when trying to assign from an element that
doesn't exist.

# WORKS
{
  my $handler = 'Foo​::Bar.baz';
  my ($class, $method) = split('.', $handler);
  say "class=$class";
  say "method=$method";
}

# FAILS
{
  my $handler = 'Foo​::Bar';
  my ($class, $method) = split('.', $handler);
  say "class=$class";
  say "method=$method";
}

# OUTPUT
class=Foo​::Bar
method=baz
ResizablePMCArray​: Can't shift from an empty array!
current instr.​: 'infix​:=' pc 12194 (src/builtins/assign.pir​:149)
called from Sub '_block40' pc 361 (EVAL_16​:127)
called from Sub '_block11' pc 32 (EVAL_16​:18)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 892
(src/PCT/HLLCompiler.pir​:508)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1224
(src/PCT/HLLCompiler.pir​:673)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1400
(src/PCT/HLLCompiler.pir​:761)
called from Sub 'parrot;Perl6;Compiler;main' pc 17717 (perl6.pir​:166)

@p6rt
Copy link
Author

p6rt commented Dec 16, 2008

From @pmichaud

Now resolved in r33948, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Dec 16, 2008

@pmichaud - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Dec 16, 2008
@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