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

can use at most one statement declaration form in entire chain of includes in Rakudo #1179

Closed
p6rt opened this issue Jul 28, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 28, 2009

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

Searchable as RT67976$

@p6rt
Copy link
Author

p6rt commented Jul 28, 2009

From @masak

The scenario is simple​: modules A.pm and B.pm both use the statement
declaration form; the former includes the latter. Rakudo dies.

$ cat A.pm
use B;

role A;
$ cat B.pm
role B;
$ perl6 A.pm
Unable to parse role definition at line 3, near ";\n"
in Main (src/gen_setting.pm​:1490)

I'd expect the restriction on statement-form declarations to be
per-file. So does STD.pm, it seems.

@p6rt
Copy link
Author

p6rt commented Jul 28, 2009

From @pmichaud

Now corrected in 426942a​:

  $ cat A.pm
  use B;

  role A;
  $ cat B.pm
  role B;

  $ ./perl6 A.pm
  $

I'll leave the ticket open to see if we can come up with a good way to
spectest this.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 28, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in at least one of these files​: t/spec/S11-modules/nested.t, t/spec/packages/RoleA.pm, t/spec/packages/RoleB.pm

commit 6a963e08bbbf22ea362a4b11fb1dc9be50a286b0
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Aug 9 16​:40​:38 2009 +0000

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

Inline Patch
diff --git a/t/spec/S11-modules/nested.t b/t/spec/S11-modules/nested.t
index 78c557d..1eb3b0c 100644
--- a/t/spec/S11-modules/nested.t
+++ b/t/spec/S11-modules/nested.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 4;
+plan 6;
 
 # test that classes and roles declared in modules get into the correct
 # namespace
@@ -15,6 +15,16 @@ eval_lives_ok 'use A::A; A::B::D ~~ A::B::B or die()',
 eval_lives_ok 'use A::A; A::B::D.new()',
               '... and instantiation works';
 
-eval_lives_ok 'use A; A.new()', 'RT #62162';
+eval_lives_ok 'use A; A.new()', 'RT 62162';
+
+eval_lives_ok 'use RoleA',
+              'can use multiple "Role $name" statements (in multiple files) RT 67976';
+
+{
+    use RoleA;
+
+    class MyFu does RoleB;
+    ok MyFu ~~ RoleB, 'Composition worked';
+}
 
 # vim: ft=perl6
diff --git a/t/spec/packages/RoleA.pm b/t/spec/packages/RoleA.pm
new file mode 100644
index 0000000..87db6ad
--- /dev/null
+++ b/t/spec/packages/RoleA.pm
@@ -0,0 +1,6 @@
+BEGIN { @*INC.push: 't/spec/packages' }
+use RoleB;
+
+role RoleA;
+
+# vim: ft=perl6
diff --git a/t/spec/packages/RoleB.pm b/t/spec/packages/RoleB.pm
new file mode 100644
index 0000000..0675e4d
--- /dev/null
+++ b/t/spec/packages/RoleB.pm
@@ -0,0 +1,3 @@
+role RoleB;
+
+# vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 9, 2009

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

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