Skip Menu |
Report information
Id: 73886
Status: resolved
Priority: 0/
Queue: perl6

Owner: moritz <moritz.lenz+perl [at] gmail.com>
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Putting a 'use' statement inside a method causes Rakudo to emit a confused method about not being in a class
Date: Mon, 29 Mar 2010 17:40:43 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 239b
$ cat A.pm grammar A { } $ cat B.pm class B; method foo() { use A; } $ perl6 B.pm You can not add a Method to a module; use a class, role or grammar [...] I'm assuming that the above should work. (It does in alpha, and in Perl 5.)
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 376b
On Mon Mar 29 08:41:18 2010, masak wrote: Show quoted text
> $ cat A.pm > grammar A { > } > > $ cat B.pm > class B; > > method foo() { > use A; > } > > $ perl6 B.pm > You can not add a Method to a module; use a class, role or grammar > [...] > > I'm assuming that the above should work. (It does in alpha, and in > Perl 5.)
Fixed; given to moritz++ for spectests. Thanks, Jonathan
Subject: [perl #73886] tests available
Date: Fri, 30 Apr 2010 14:35:04 -0500
To: perl6-bugs-followup [...] perl.org
From: kyleha [...] gmail.com
Download (untitled) / with headers
text/plain 1.1k
This is an automatically generated mail to inform you that tests are now available in t/spec/S10-packages/use-with-class.t commit d8944e8b6eac93f4cace32bbc6588b0d323b0320 Author: moritz <moritz@c213334d-75ef-0310-aa23-eaa082d1ae64> Date: Fri Apr 30 19:33:41 2010 +0000 [t/spec] Test for RT #73886, loading a class from inside a method git-svn-id: http://svn.pugscode.org/pugs@30527 c213334d-75ef-0310-aa23-eaa082d1ae64 diff --git a/t/spec/S10-packages/use-with-class.t b/t/spec/S10-packages/use-with-class.t index e2b7801..ec664bf 100644 --- a/t/spec/S10-packages/use-with-class.t +++ b/t/spec/S10-packages/use-with-class.t @@ -5,7 +5,7 @@ use Test; # L<S11/Compile-time Importation> -plan 7; +plan 8; # test that 'use' imports class names defined in importet packages @@ -32,4 +32,18 @@ eval_lives_ok 'Stupid::Class.new()', 'can instantiate object of "imported" class } +# class loading inside a method +# RT #73886 +{ + BEGIN { @*INC.push: 't/spec/packages' } + class MethodLoadingTest { + method doit { + use Foo; + Foo.new.foo(); + } + } + is MethodLoadingTest.doit(), 'foo', 'can load class from inside a method'; + +} + # vim: ft=perl6


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org