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 should do type checking on the invocant parameter on methods #1451
Comments
From @masak<masak> mwhaha! I'm not really sure what should happen. Perhaps a compile-time error |
From @masak<masak> rakudo: class A {}; class B { method foo(A $foo:) { say $foo.WHAT } }; B.new.foo S12 says "You need not declare the invocant's type, since the lexical class of the invocant is |
|
@masak - Status changed from 'new' to 'open' |
From @jnthnOn Sun Dec 20 13:49:07 2009, masak wrote:
It now bothers to type check the invocant and complains, rather than Given to moritz++ for tests. Jonathan |
|
@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-methods/instance.t commit 1b0acff2dd40389c3093751fec9d596734188835 [t/spec] test for RT #71476, invocant type constraint should be checked at method call time Inline Patchdiff --git a/t/spec/S12-methods/instance.t b/t/spec/S12-methods/instance.t
index d3824a5..9c4cef1 100644
--- a/t/spec/S12-methods/instance.t
+++ b/t/spec/S12-methods/instance.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 33;
+plan 34;
=begin pod
@@ -199,4 +199,13 @@ is AnonInvocant.new().me, AnonInvocant, 'a typed $: as invocant is OK';
is Y.new.y(*), 1, 'Can dispatch y(*)';
}
+{
+ class InvocantTypeCheck {
+ method x(Int $a:) {
+ 42;
+ }
+ }
+ dies_ok { InvocantTypeCheck.new.x() }, 'Invocant type is checked';
+}
+
# vim: ft=perl6 |
Migrated from rt.perl.org#71476 (status was 'resolved')
Searchable as RT71476$
The text was updated successfully, but these errors were encountered: