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

Null PMC access when doing 'use' within class in Rakudo #888

Closed
p6rt opened this issue Apr 13, 2009 · 9 comments
Closed

Null PMC access when doing 'use' within class in Rakudo #888

p6rt opened this issue Apr 13, 2009 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Apr 13, 2009

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

Searchable as RT64688$

@p6rt
Copy link
Author

p6rt commented Apr 13, 2009

From @masak

On Rakudo 679e480 and Parrot r38094, the following happens when one
tries to execute a 'use' statement within a class body​:

$ perl6 -e 'class A; use Test'
Null PMC access in set_pmc_keyed()
[...]

Semicolon or block syntax on the class decl ist egal. So is using
'module', 'package' or 'grammar'.

@p6rt
Copy link
Author

p6rt commented Jul 30, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S10-packages/basic.t

commit f8866a9b95a6789d0692b1018a771d35e7ff35ef
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Thu Jul 30 19​:22​:33 2009 +0000

  [t/spec] Tests for RT #​64688
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27820 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S10-packages/basic.t b/t/spec/S10-packages/basic.t
index 44c2c4e..9fe31ed 100644
--- a/t/spec/S10-packages/basic.t
+++ b/t/spec/S10-packages/basic.t
@@ -4,7 +4,7 @@ use v6;
 
 use Test;
 
-plan 22;
+plan 32;
 
 regex fairly_conclusive_platform_error {:i ^\N*<<Null?>>}
 
@@ -146,4 +146,18 @@ eval_lives_ok q' module MapTester { (1, 2, 3).map: { $_ } } ',
        'array initialization works fine in imported subs';
 }
 
+#?rakudo todo 'RT #64688'
+{
+    eval_lives_ok 'class RT64688_c1;use Test', 'use after class line';
+    eval_lives_ok 'class RT64688_c1 { use Test }', 'use in class block';
+    eval_lives_ok 'module RT64688_m1;use Test', 'use after module line';
+    eval_lives_ok 'module RT64688_m2 { use Test }', 'use in module block';
+    eval_lives_ok 'package RT64688_p1;use Test', 'use after package line';
+    eval_lives_ok 'package RT64688_p2 { use Test }', 'use in package block';
+    eval_lives_ok 'grammar RT64688_g1;use Test', 'use after grammar line';
+    eval_lives_ok 'grammar RT64688_g2 { use Test }', 'use in grammar block';
+    eval_lives_ok 'role RT64688_r1;use Test', 'use after role line';
+    eval_lives_ok 'role RT64688_r2 { use Test }', 'use in role block';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jul 30, 2009

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

@p6rt
Copy link
Author

p6rt commented Oct 6, 2009

From @carbin

Easiest way to do this​:

class Foo { use Test; }
Null PMC access in set_pmc_keyed()
in Main (src/gen_setting.pm​:444)

Real way to do this​:

$ perl6 test.pl
Null PMC access in set_pmc_keyed()
in Main (src/gen_setting.pm​:444)
$ cat test.pl
use Foo;
$ cat Foo.pm
class Foo {
use Bar;
}
$ cat Bar.pm
class Bar {
method baz is export {}
}

Putting the 'use' declaration outside of the class works as a work-around.

--
Carlin

@p6rt
Copy link
Author

p6rt commented Dec 15, 2009

From philipp@marek.priv.at

Using the two attached files, and doing

  perl6 -e 'use W'

gives me a Null PMC access.

Without "is export" it's gone, but of course the function isn't exported.

--
Versioning your /etc, /home or even your whole installation?
  Try fsvs (fsvs.tigris.org)!

@p6rt
Copy link
Author

p6rt commented Dec 15, 2009

From philipp@marek.priv.at

S.pm

@p6rt
Copy link
Author

p6rt commented Dec 15, 2009

From philipp@marek.priv.at

W.pm

@p6rt
Copy link
Author

p6rt commented Mar 23, 2010

From @ShimmerFairy

None of these problems return a Null PMC access anymore. However, the
ones that involve the export keyord ("module baz is export", for
example) return a "Can't handle scope declarator on modules yet" error.

The posted additions to t/spec/S10-packages/basic.t pass (although the
additions had to be run manually due to unrelated problems with the test
file). This bug is resolved.
--
Don't Panic!

@p6rt
Copy link
Author

p6rt commented Mar 23, 2010

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

@p6rt p6rt closed this as completed Mar 23, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant