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

signature in only method issues #4696

Closed
p6rt opened this issue Oct 30, 2015 · 4 comments
Closed

signature in only method issues #4696

p6rt opened this issue Oct 30, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Oct 30, 2015

Migrated from rt.perl.org#126506 (status was 'rejected')

Searchable as RT126506$

@p6rt
Copy link
Author

p6rt commented Oct 30, 2015

From @lizmat

22​:30​:53] <lizmat> m​: class A { has $.a; method gist(A​:D​:) { $!a } }; A.gist # invocant smiley is ignored if not a multi :-(
[22​:30​:54] <+camelia> rakudo-moar 4e45f0​: OUTPUT«Invocant requires an instance of type A, but a type object was passed. Did you forget a .new?␤ in method gist at /tmp/jBAZ4pw7DY​:1␤ in block <unit> at /tmp/jBAZ4pw7DY​:1␤␤»
[22​:31​:18] <lizmat> feels like it should at least warn about the useless invocant signature
[22​:59​:37] <lizmat> m​: class A { has $.a; method gist(Int​:D​:) { $!a } }; A.gist # invocant smiley is ignored if not a multi :-(
[22​:59​:38] <+camelia> rakudo-moar 2e19eb​: OUTPUT«Type check failed in binding <anon>; expected Int but got A␤ in method gist at /tmp/AfZO2yeTj7​:1␤ in block <unit> at /tmp/AfZO2yeTj7​:1␤␤»
[23​:00​:33] <lizmat> that should probably be a compile time error
[23​:00​:46] <lizmat> m​: class A { has $.a; method gist(Int​:) { $!a } }; A.gist
[23​:00​:46] <+camelia> rakudo-moar 2e19eb​: OUTPUT«Type check failed in binding <anon>; expected Int but got A␤ in method gist at /tmp/ufwv1H5sTm​:1␤ in block <unit> at /tmp/ufwv1H5sTm​:1␤␤»

@p6rt
Copy link
Author

p6rt commented Nov 2, 2015

From @jnthn

On Fri Oct 30 15​:03​:44 2015, elizabeth wrote​:

22​:30​:53] <lizmat> m​: class A { has $.a; method gist(A​:D​:) { $!a
} }; A.gist # invocant smiley is ignored if not a multi :-(
[22​:30​:54] <+camelia> rakudo-moar 4e45f0​: OUTPUT«Invocant requires
an instance of type A, but a type object was passed. Did you forget a
.new?␤ in method gist at /tmp/jBAZ4pw7DY​:1␤ in block <unit> at
/tmp/jBAZ4pw7DY​:1␤␤»

It *did* pay attention to it. If it weren't there, you'd not get such an error, but instead this one​:

C​:\consulting\rakudo>perl6-m -e "class A { has $.a; method gist(A​:) { $!a } }; A.gist"
Cannot look up attributes in a type object
  in method gist at -e​:1
  in block <unit> at -e​:1

[22​:31​:18] <lizmat> feels like it should at least warn about the
useless invocant signature

No, 'cus it's paying attention to it. Maybe you're expecting the presence of a :D/​:U to imply "multi" on the candidate? This isn't happening (by design, nowadays). An only method hides any inherited method, multi or otherwise, because whether the things you inherit from are multi or not is an implementation detail of the base class.

So, no bug here, I think.

Thanks,

/jnthn

@p6rt
Copy link
Author

p6rt commented Nov 2, 2015

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

@p6rt p6rt closed this as completed Nov 2, 2015
@p6rt
Copy link
Author

p6rt commented Nov 2, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant