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 attempting to get at a method within a class using &Class::method syntax in Rakudo #1677

Closed
p6rt opened this issue Apr 10, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 10, 2010

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

Searchable as RT74236$

@p6rt
Copy link
Author

p6rt commented Apr 10, 2010

From @masak

<masak> rakudo​: class A {}; my $x = &A​::nosuch
<p6eval> rakudo 43f865​: OUTPUT«Null PMC access in can() [...]
<masak> alpha​: class A {}; my $x = &A​::nosuch
<p6eval> alpha 30e0ed​: ( no output )
* masak submits rakudobug
<masak> is that still the way to get at a method in Perl 6?

@p6rt
Copy link
Author

p6rt commented Jul 16, 2010

From @jnthn

On Sat Apr 10 14​:26​:00 2010, masak wrote​:

<masak> rakudo​: class A {}; my $x = &A​::nosuch
<p6eval> rakudo 43f865​: OUTPUT«Null PMC access in can() [...]
* masak submits rakudobug

Now​:

class A {}; my $x = &A​::nosuch
Code()

<masak> is that still the way to get at a method in Perl 6?

Yes but only if you marked the method "our". Otherwise it's not
installed in da package.

Given to moritz++ for testing; note Code as what you get is good to test
for too​:

00​:00 <@​jnthn> TimToady​: say &nosuch​::sub.WHAT # what should this be?
00​:00 <@​jnthn> TimToady​: Failure object? Any()?
00​:28 <@​TimToady> jnthn​: Code() I'd think

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jul 16, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

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

@p6rt p6rt closed this as completed Jul 18, 2010
@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S12-methods/what.t

commit b2c44b304761621c37f3a9b72f2b28461db3dbda
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Jul 18 11​:57​:00 2010 +0000

  [t/spec] tests for RT #​74236, &Class​::method access
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31744 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S12-methods/what.t b/t/spec/S12-methods/what.t
index d315964..b1a1056 100644
--- a/t/spec/S12-methods/what.t
+++ b/t/spec/S12-methods/what.t
@@ -95,6 +95,19 @@ ok 1.1 == 11/10, 'decimal == the equivalent rational';
     is ~2.WHAT, 'Int()', 'assignment to Int.WHAT does nothing';
 }
 
+{
+    class AccessMethods {
+        our method a { };
+        method b { };
+    }
+
+    ok &AccessMethods::a.defined, 'Can access "our" method with &class::method';
+    ok &AccessMethods::a ~~ Method, '... and got a Method back';
+    nok &AccessMethods::b.defined, '"has" methods are hidden';
+    lives_ok {&AccessMethods::c.defined and die "foo"}, 'non-existant method access livess (and returns undef)';
+
+}
+
 done_testing;
 
 # vim: ft=perl6

@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