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
Comments
From @masak<moritz_> rakudo: role A[$x, $y] { method x { say $x + $y } }; A[4, 5].new.x |
From @jnthnOn Thu Jun 17 02:24:10 2010, masak wrote:
Fixed now:
Add added a test. Thanks, Jonathan |
The RT System itself - Status changed from 'new' to 'open' |
@jnthn - Status changed from 'open' to 'resolved' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S14-roles/instantiation.t commit 0b2a7086619160623896c339ca51832fd8ca4e26 [t/spec] Add a test for RT#75822 and correct another test so we can un-todo it. Inline Patchdiff --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 { } |
Migrated from rt.perl.org#75822 (status was 'resolved')
Searchable as RT75822$
The text was updated successfully, but these errors were encountered: