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

"Can't call routine" error message doesn't include Capture that caused the error #2831

Closed
p6rt opened this issue Jul 19, 2012 · 4 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jul 19, 2012

Migrated from rt.perl.org#114204 (status was 'resolved')

Searchable as RT114204$

@p6rt
Copy link
Author

p6rt commented Jul 19, 2012

From sirrobert@gmail.com

A snippet from IRC...

16​:18 < sirrobert> On the error that says, "Cannot call 'whatever'; none of
these signature match​: " it would be great
  if we could add the signature we tried to call it with
16​:18 < masak> yeah.
16​:18 < masak> do we have an RT ticket for that?
16​:18 * masak checks
16​:20 < masak> doesn't seem we do.
16​:20 < masak> sirrobert​: if you have time, please put together a nice
concrete example where having this would help,
  and submit to rakudobug@​perl.org. thank you.
16​:20 < sirrobert> sure thing

As requested, here's a snippet that demonstrates the utility of this
request​:

class A {
  has Hash %!h;

  multi method f (Pair $p) {
  return $p.WHAT;
  }

};

my $n = (a => b => 'c');
my $m = a => b => 'c';

say $n.WHAT;
say $m.WHAT;

say A.new.f(a => b => 'c');

The output of this file is​:

Pair()
Pair()
Cannot call 'f'; none of these signatures match​:
:(A , Pair $p, Mu *%_)

  in method f at src/gen/CORE.setting​:310
  in block <anon> at ./test.p6​:20

It is not obvious to me how to change the signature of the method to make
the last call work. I *think* in the context of a function call the nested
pair is counted as a hash or something... still working on it. In the
meantime, it would be helpful to know what signature I was (apparently)
trying to call with.

Thanks!

-Sir

@p6rt
Copy link
Author

p6rt commented Mar 21, 2015

From @Mouq

On Thu Jul 19 13​:54​:31 2012, sirrobert@​gmail.com wrote​:

A snippet from IRC...

16​:18 < sirrobert> On the error that says, "Cannot call 'whatever'; none of
these signature match​: " it would be great
if we could add the signature we tried to call it with
16​:18 < masak> yeah.
16​:18 < masak> do we have an RT ticket for that?
16​:18 * masak checks
16​:20 < masak> doesn't seem we do.
16​:20 < masak> sirrobert​: if you have time, please put together a nice
concrete example where having this would help,
and submit to rakudobug@​perl.org. thank you.
16​:20 < sirrobert> sure thing

As requested, here's a snippet that demonstrates the utility of this
request​:

class A {
has Hash %!h;

multi method f (Pair $p) {
return $p.WHAT;
}

};

my $n = (a => b => 'c');
my $m = a => b => 'c';

say $n.WHAT;
say $m.WHAT;

say A.new.f(a => b => 'c');

The output of this file is​:

Pair()
Pair()
Cannot call 'f'; none of these signatures match​:
:(A , Pair $p, Mu *%_)

in method f at src/gen/CORE.setting​:310
in block <anon> at ./test.p6​:20

It is not obvious to me how to change the signature of the method to make
the last call work. I *think* in the context of a function call the nested
pair is counted as a hash or something... still working on it. In the
meantime, it would be helpful to know what signature I was (apparently)
trying to call with.

Thanks!

-Sir

Current output​:

07​:08 <Mouq> m​: class A { multi method f (Pair $p) {return $p.WHAT;}}; say A.new.f("a" => b => "c");
07​:08 <camelia> rakudo-moar dfad9c​: OUTPUT«(Pair)␤»
07​:08 <Mouq> m​: class A { multi method f (Pair $p) {return $p.WHAT;}}; say A.new.f(a => b => "c");
07​:08 <camelia> rakudo-moar dfad9c​: OUTPUT«Cannot call f(A​: :a(Pair)); none of these signatures match​:␤ (A​: Pair $p, *%_)␤ in block
  <unit> at /tmp/tV96UsCt6B​:1␤␤»

The erroneous call now lists "f(A​: :a(Pair))". Tests for this already exist in Roast in the file S06-signature/errors.t.

Closing this ticket as resolved :)

~Mouq

@p6rt
Copy link
Author

p6rt commented Mar 21, 2015

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

@p6rt
Copy link
Author

p6rt commented Mar 21, 2015

@Mouq - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 21, 2015
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