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

shadowing a parameter leads to "Null PMC access in type()" #738

Closed
p6rt opened this issue Mar 2, 2009 · 7 comments
Closed

shadowing a parameter leads to "Null PMC access in type()" #738

p6rt opened this issue Mar 2, 2009 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 2, 2009

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

Searchable as RT63596$

@p6rt
Copy link
Author

p6rt commented Mar 2, 2009

From @moritz

# file next-bug.pl
use v6;
sub s($i is copy) {
  my @​array;
  for 1..3 {
  @​array.push($i);
  my $i = 1 + $i; # <--- Error
  }
}

s(9);

# end of file

$ perl6 next-bug.pl
Null PMC access in type()
current instr.​: 'parrot;P6metaclass;dispatch' pc 130
(src/classes/ClassHOW.pir​:93)
called from Sub '_block35' pc 334 (EVAL_19​:140)
called from Sub 's' pc 202 (EVAL_19​:85)
called from Sub '_block14' pc 71 (EVAL_19​:42)
called from Sub '!UNIT_START' pc 17743 (src/builtins/guts.pir​:325)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 950
(src/PCT/HLLCompiler.pir​:527)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1275
(src/PCT/HLLCompiler.pir​:688)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1456
(src/PCT/HLLCompiler.pir​:778)
called from Sub 'parrot;Perl6;Compiler;main' pc 22036 (perl6.pir​:162)

If I remove either the 'my' in the marked line, or the @​array.push($i) the
error goes away.

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

From @bbkr

On Kiev build​:

[12​:02] <bbkr> rakudo​: sub s($i is copy) { my @​array; for 1..3 {
@​array.push($i); my $i = 1 + $i; }}; s(9);
[12​:02] <p6eval> rakudo 36998b​: OUTPUT«Use of uninitialized value in
numeric context␤Use of uninitialized value in numeric context␤Use of
uninitialized value in numeric context␤»

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

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

@p6rt
Copy link
Author

p6rt commented Sep 23, 2011

From @coke

On Wed Jun 30 03​:04​:26 2010, bbkr wrote​:

On Kiev build​:

[12​:02] <bbkr> rakudo​: sub s($i is copy) { my @​array; for 1..3 {
@​array.push($i); my $i = 1 + $i; }}; s(9);
[12​:02] <p6eval> rakudo 36998b​: OUTPUT«Use of uninitialized value in
numeric context␤Use of uninitialized value in numeric context␤Use of
uninitialized value in numeric context␤»

Just needs tests.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 30, 2012

From @diakopter

On Fri Sep 23 11​:38​:09 2011, coke wrote​:

On Wed Jun 30 03​:04​:26 2010, bbkr wrote​:

On Kiev build​:

[12​:02] <bbkr> rakudo​: sub s($i is copy) { my @​array; for 1..3 {
@​array.push($i); my $i = 1 + $i; }}; s(9);
[12​:02] <p6eval> rakudo 36998b​: OUTPUT«Use of uninitialized value in
numeric context␤Use of uninitialized value in numeric context␤Use of
uninitialized value in numeric context␤»

Just needs tests.

eval_dies_ok test added in 7ea105f. rakudo still does not do the right
thing, so it fails the test, but for another reason. It no longer Null
PMCs, though.

@p6rt
Copy link
Author

p6rt commented May 30, 2012

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

@p6rt p6rt closed this as completed May 30, 2012
@p6rt
Copy link
Author

p6rt commented Jan 3, 2013

From @moritz

Fwiw, Rakudo now does the right thing and complains about the shadowing
at compile time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant