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't instantiate a role with two arguments in Rakudo #1844

Closed
p6rt opened this issue Jun 17, 2010 · 5 comments
Closed

Can't instantiate a role with two arguments in Rakudo #1844

p6rt opened this issue Jun 17, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 17, 2010

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

Searchable as RT75822$

@p6rt
Copy link
Author

p6rt commented Jun 17, 2010

From @masak

<moritz_> rakudo​: role A[$x, $y] { method x { say $x + $y } }; A[4, 5].new.x
<p6eval> rakudo 012ea2​: OUTPUT«No applicable candidates found to
dispatch to for '_block52'. Available candidates are​:␤​:(Mu $x, Mu
$y)␤␤ in main program body at line 1␤»
<jnthn> ...wtf?
* masak submits rakudobug
<masak> rakudo​: role A[$x, $y] { method x { say $x + $y } }; A[4, 5].new
<p6eval> rakudo 012ea2​: OUTPUT«No applicable candidates found to
dispatch to for _block52'. Available candidates are​:␤​:(Mu $x, Mu $y)␤␤
in main program body at line 1␤»

@p6rt
Copy link
Author

p6rt commented Jun 19, 2010

From @jnthn

On Thu Jun 17 02​:24​:10 2010, masak wrote​:

<moritz_> rakudo​: role A[$x, $y] { method x { say $x + $y } }; A[4,
5].new.x
<p6eval> rakudo 012ea2​: OUTPUT«No applicable candidates found to
dispatch to for '_block52'. Available candidates are​:␤​:(Mu $x, Mu
$y)␤␤ in main program body at line 1␤»
<jnthn> ...wtf?
* masak submits rakudobug
<masak> rakudo​: role A[$x, $y] { method x { say $x + $y } }; A[4, 5].new
<p6eval> rakudo 012ea2​: OUTPUT«No applicable candidates found to
dispatch to for _block52'. Available candidates are​:␤​:(Mu $x, Mu $y)␤␤
in main program body at line 1␤»

Fixed now​:

role A[$x, $y] { method x { say $x + $y } }; A[4, 5].new.x
9

Add added a test.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jun 19, 2010

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

@p6rt
Copy link
Author

p6rt commented Jun 19, 2010

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

@p6rt p6rt closed this as completed Jun 19, 2010
@p6rt
Copy link
Author

p6rt commented Jun 19, 2010

From @kyleha

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

commit 0b2a7086619160623896c339ca51832fd8ca4e26
Author​: jnthn <jnthn@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Jun 19 20​:13​:14 2010 +0000

  [t/spec] Add a test for RT#​75822 and correct another test so we can un-todo it.
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31380 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S14-roles/instantiation.t b/t/spec/S14-roles/instantiation.t
index a20f016..0acce9c 100644
--- a/t/spec/S14-roles/instantiation.t
+++ b/t/spec/S14-roles/instantiation.t
@@ -8,7 +8,7 @@ use Test;
 # classes. Hence, RoleName.new() instantiates an object that will probably fail
 # on all stubs.
 
-plan 18;
+plan 19;
 
 role SampleRole {
   method sample_method () { 42 }
@@ -25,8 +25,7 @@ role SampleRole {
   my $obj2 = SampleRole.new;
   ok $obj.WHAT === $obj2.WHAT, "Punned role classes have the same .WHAT";
 
-  #?rakudo todo 'protoobject regression'
-  is ~$obj.WHAT, 'SampleRole', '.WHAT as a string gives the name of the role';
+  is ~$obj.WHAT, 'SampleRole()', '.WHAT as a string gives the name of the role';
 }
 
 role WithAttr {
@@ -57,6 +56,12 @@ role ParaRole[$x] {
     is $obj2.get_x, 100, "instantiated object has method with correct associated role parameter";
 }
 
+role ParaRole2Args[$x, $y] {
+    method x { $x + $y }
+}
+
+is ParaRole2Args[4, 5].new.x, 9, 'instantiating a parametric role with two arguments works';
+
 # Can also pun a role and inherit from the punned class.
 {
     class TestA is SampleRole { }

@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