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

Cannot access lexical variable declared in role from method called in class doing that role in Rakudo #1371

Closed
p6rt opened this issue Oct 20, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 20, 2009

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

Searchable as RT69919$

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

From @masak

<masak> rakudo​: role A { my $foo = "OH HAI"; method bar() { say $foo }
}; class B does A {}; B.new.bar
<p6eval> rakudo 1ab069​: OUTPUT«Null PMC access in type() [...]
<masak> haha!
* masak gleefully submits rakudobug

@p6rt
Copy link
Author

p6rt commented Oct 21, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S14-roles/composition.t

commit 8282341ffa5af1abb35a31d470184058a98c5009
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Wed Oct 21 18​:29​:00 2009 +0000

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

Inline Patch
diff --git a/t/spec/S14-roles/composition.t b/t/spec/S14-roles/composition.t
index 57798e7..5d3c93f 100644
--- a/t/spec/S14-roles/composition.t
+++ b/t/spec/S14-roles/composition.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 19;
+plan *;
 
 # L<S14/Roles/"Roles may be composed into a class at compile time">
 
@@ -85,4 +85,18 @@ ok rB !~~ RT64002, 'role not matched by second role it does';
     is DE.new.foo, 'OH HAI', 'same with punning and inheritance';
 }
 
+# RT #69919
+{
+    role RT69919 {
+        my $lex = 'Luthor';
+        method rt69919 { return $lex }
+    }
+    class IL does RT69919 {}
+
+    #?rakudo skip 'RT 69919, Null PMC access in type()'
+    is IL.new.rt69919, 'Luthor', 'access lexical declared in role from method called via class that does the role';
+}
+
+done_testing;
+
 # vim: syn=perl6

@p6rt
Copy link
Author

p6rt commented Oct 21, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

Works now, and tests are passing.

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

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

@p6rt p6rt closed this as completed Mar 9, 2010
@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