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
Cannot delegate from user-defined .new to self.Object::new in Rakudo #1353
Comments
From @masak<masak> rakudo: class A { has |
From @jnthnOn Fri Oct 09 02:14:30 2009, masak wrote:
Fail. This is just a recursive call to the same method. However, Rakudo
And after some s/Object/Mu/, this now works:
Giving to moritz++ for spectesting. Thanks, Jonathan |
The RT System itself - Status changed from 'new' to 'open' |
@moritz - Status changed from 'open' to 'resolved' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S12-construction/new.t commit bab5843563abbdd1932d8f6436b16d74009ce39a [t/spec] tests for RT #69676, delegating .new to self.Mu::new Inline Patchdiff --git a/t/spec/S12-construction/new.t b/t/spec/S12-construction/new.t
index c9ae68e..38894c9 100644
--- a/t/spec/S12-construction/new.t
+++ b/t/spec/S12-construction/new.t
@@ -56,6 +56,23 @@ is $o.x, 5, '... worked for the class Parent (other order)';
dies_ok { RT71706::Artie.new }, 'die trying to instantiate missing class';
}
+# RT #69676
+{
+ class NewFromMu {
+ has $.x;
+ has $.y;
+
+ method new($a, $b) {
+ self.Mu::new(:x($a), :y($b));
+ }
+ }
+
+ my $x;
+ lives_ok { $x = NewFromMu.new('j', 'k') }, 'can delegate to self.Mu::new';
+ is $x.x, 'j', '... got the right attribute (1)';
+ is $x.y, 'k', '... got the right attribute (2)';
+}
+
done_testing;
# vim: ft=perl6 |
Migrated from rt.perl.org#69676 (status was 'resolved')
Searchable as RT69676$
The text was updated successfully, but these errors were encountered: