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

Very unhelpful error message for declaring a role with a name already assigned to a class #1153

Closed
p6rt opened this issue Jul 22, 2009 · 9 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 22, 2009

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

Searchable as RT67768$

@p6rt
Copy link
Author

p6rt commented Jul 22, 2009

From hudnix@walttollefson.com

<hudnix>rakudo​: role List {method foo{1}}

<p6eval>rakudo 3b1bda​: OUTPUT«Method '!add_variant' not found for invocant
of class ”␤»

My first rakudobug...

@p6rt
Copy link
Author

p6rt commented Jul 22, 2009

From @masak

On Tue Jul 21 17​:05​:56 2009, hudnix@​walttollefson.com wrote​:

<hudnix>rakudo​: role List {method foo{1}}

<p6eval>rakudo 3b1bda​: OUTPUT«Method '!add_variant' not found for invocant
of class ”␤»

My first rakudobug...

Declaring an existing class as a role seems to be the culprit here.

<masak> rakudo​: role List {}
<p6eval> rakudo 5901f2​: OUTPUT«Method '!add_variant' not found for
invocant of class ''␤»
<masak> rakudo​: role Associative {}
<p6eval> rakudo 5901f2​: ( no output )
<jnthn> rakudo​: class List { }
<p6eval> rakudo 5901f2​: OUTPUT«Re-declaration of type List at line 2,
near "" [...]

@p6rt
Copy link
Author

p6rt commented Jul 22, 2009

From [Unknown Contact. See original ticket]

On Tue Jul 21 17​:05​:56 2009, hudnix@​walttollefson.com wrote​:

<hudnix>rakudo​: role List {method foo{1}}

<p6eval>rakudo 3b1bda​: OUTPUT«Method '!add_variant' not found for invocant
of class ”␤»

My first rakudobug...

Declaring an existing class as a role seems to be the culprit here.

<masak> rakudo​: role List {}
<p6eval> rakudo 5901f2​: OUTPUT«Method '!add_variant' not found for
invocant of class ''␤»
<masak> rakudo​: role Associative {}
<p6eval> rakudo 5901f2​: ( no output )
<jnthn> rakudo​: class List { }
<p6eval> rakudo 5901f2​: OUTPUT«Re-declaration of type List at line 2,
near "" [...]

@p6rt
Copy link
Author

p6rt commented Jul 22, 2009

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 12, 2010

From @bbkr

$ perl6 -e 'role List { method foo {1.say} }; class A does List {};
A.new.foo'
1

Works, taken for tests.

@p6rt
Copy link
Author

p6rt commented Jul 12, 2010

From @bbkr

According to STD this should pass

[16​:35] <moritz_> std​: role Array { }
[16​:35] <p6eval> std 31639​: OUTPUT«ok 00​:01 110m␤»

So I'm changing ticket subject

@p6rt
Copy link
Author

p6rt commented Jul 12, 2010

From @bbkr

tests added in
pugs/t/spec/S14-roles/basic.t

@p6rt
Copy link
Author

p6rt commented Jul 12, 2010

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

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

p6rt commented Jul 12, 2010

From @kyleha

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

commit d848f22aab4c9d42abb32207dcbf1d4a39dc7860
Author​: bbkr <bbkr@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Jul 12 15​:01​:12 2010 +0000

  [t/spec] tests for RT #​67768 Cannot declare a role with a name already assigned to a class
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31641 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S14-roles/basic.t b/t/spec/S14-roles/basic.t
index 20d33f2..e0fc09e 100644
--- a/t/spec/S14-roles/basic.t
+++ b/t/spec/S14-roles/basic.t
@@ -143,6 +143,16 @@ eval_dies_ok '0 but RT66178', '"but" with non-existent role dies';
 # RT #72848
 lives_ok {0 but True}, '0 but True has applicable candidate';
 
+# RT #67768
+{
+    lives_ok { role List { method foo { 67768 } } },
+        'can declare a role with a name already assigned to a class';
+    lives_ok { class C67768 does List { } },
+        'can use a role with a name already assigned to a class';
+    is C67768.new.foo, 67768,
+        'can call method from a role with a name already assigned to a class';
+}
+
 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