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
Rakudo shouldn't allow calling $obj.UnrelatedClass::method() on a non-ancestor class #1305
Comments
From @masak<masak> rakudo: class A { method foo() { say "A" } }; class B {}; my |
From @pmichaudOn Mon, Sep 21, 2009 at 06:41:37AM -0700, Carl Mäsak wrote:
I agree that the existing behavior is wrong, but what Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzOn Mon Sep 21 12:07:15 2009, pmichaud wrote:
I'd say the latter, because "type mismatch on the invocant" might be Cheers, |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S12-class/inheritance.t commit 395a0b0e02df40b34795fa94d1e9cdcdecc82369 [t/spec] test for RT #69262 Inline Patchdiff --git a/t/spec/S12-class/inheritance.t b/t/spec/S12-class/inheritance.t
index 4260be3..db6f263 100644
--- a/t/spec/S12-class/inheritance.t
+++ b/t/spec/S12-class/inheritance.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 36;
+plan 38;
# L<S12/Classes/An "isa" is just a trait that happens to be another class>
@@ -20,6 +20,10 @@ class Foo::Bar is Foo {
method super_baz ($self:) { return $self.Foo::baz() }
}
+class Unrelated {
+ method something { 'bad' };
+}
+
my $foo_bar = Foo::Bar.new();
isa_ok($foo_bar, Foo::Bar);
@@ -47,6 +51,11 @@ my $fud;
lives_ok { $fud = $foo_bar.getme.fud }, 'chained method dispatch on altered method';
is($fud, "Foo::Bar::fud", "returned value is correct");
+is $foo_bar.Foo::baz, 'Foo::baz', '$obj.Class::method syntax works';
+#?rakudo todo 'RT 69262'
+dies_ok { $foo_bar.Unrelated::something() },
+ 'Cannot call unrelated method with $obj.Class::method syntax';
+
# See thread "Quick OO .isa question" on p6l started by Ingo Blechschmidt:
# L<"http://www.nntp.perl.org/group/perl.perl6.language/22220">
|
From @jnthnOn Sat Sep 26 09:23:06 2009, moritz wrote:
Agree, done while putting back .A::foo style syntax, and un-todo'd the Thanks, Jonathan |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#69262 (status was 'resolved')
Searchable as RT69262$
The text was updated successfully, but these errors were encountered: