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

"Too many positionals" error could use info about method/invocant #6275

Closed
p6rt opened this issue May 31, 2017 · 6 comments
Closed

"Too many positionals" error could use info about method/invocant #6275

p6rt opened this issue May 31, 2017 · 6 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented May 31, 2017

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

Searchable as RT131408$

@p6rt
Copy link
Author

p6rt commented May 31, 2017

From @briandfoy

I have this program​:

  #!/Applications/Rakudo/bin/perl6

  use Test;
  bail-out();

When I run it, it complains about too many parameters​:

  $ prove -e 'perl6 -Ilib' t/bail.t
  t/bail.t .. Any
  Too many positionals passed; expected 1 argument but got 2
  in sub bail-out at
/Applications/Rakudo/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E
(Test) line 258
  in block <unit> at t/bail.t line 4

  t/bail.t .. Dubious, test returned 1 (wstat 256, 0x100)
  No subtests run

  Test Summary Report
  -------------------
  t/bail.t (Wstat​: 256 Tests​: 0 Failed​: 0)
  Non-zero exit status​: 1
  Parse errors​: No plan found in TAP output
  Files=1, Tests=0, 2 wallclock secs ( 0.03 usr 0.01 sys + 2.14
cusr 0.16 csys = 2.34 CPU)
  Result​: FAIL

This is the section causing the problem​:

  256 sub bail-out ($desc?) is export {
  257 $output.put​: join ' ', 'Bail out!', ( $desc ?? $desc !! '' );
  258 $done_testing_has_been_run = 1;
  259 exit 255;
  260 }

I made several changes to try to suss out the problem, but I couldn't
make the error go away without removing line 257. When I check "$output.^name",
I get "Any".

Running without `prove` shows the same problem​:

  $ perl6 t/bail.t
  Too many positionals passed; expected 1 argument but got 2
  in sub bail-out at
/Applications/Rakudo/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E
(Test) line 257
  in block <unit> at t/bail.t line 4

Running it in https://glot.io/new/perl6 shows the same thing.

Besides the actual error, the error message isn't great. I would have
liked it to mention the method name and class causing the problem.

This is​:

  $ perl6 -v
  This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
  implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented May 31, 2017

From @lizmat

Fixed with cb82760625f6b8fec64a75 , tests needed.

On 31 May 2017, at 07​:20, brian d foy (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by "brian d foy"
# Please include the string​: [perl #​131408]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131408 >

I have this program​:

#!/Applications/Rakudo/bin/perl6

use Test;
bail-out();

When I run it, it complains about too many parameters​:

$ prove -e 'perl6 -Ilib' t/bail.t
t/bail.t .. Any
Too many positionals passed; expected 1 argument but got 2
in sub bail-out at
/Applications/Rakudo/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E
(Test) line 258
in block <unit> at t/bail.t line 4

t/bail.t .. Dubious, test returned 1 (wstat 256, 0x100)
No subtests run

Test Summary Report
-------------------
t/bail.t (Wstat​: 256 Tests​: 0 Failed​: 0)
Non-zero exit status​: 1
Parse errors​: No plan found in TAP output
Files=1, Tests=0, 2 wallclock secs ( 0.03 usr 0.01 sys + 2.14
cusr 0.16 csys = 2.34 CPU)
Result​: FAIL

This is the section causing the problem​:

256 sub bail-out ($desc?) is export {
257 $output.put​: join ' ', 'Bail out!', ( $desc ?? $desc !! '' );
258 $done_testing_has_been_run = 1;
259 exit 255;
260 }

I made several changes to try to suss out the problem, but I couldn't
make the error go away without removing line 257. When I check "$output.^name",
I get "Any".

Running without `prove` shows the same problem​:

$ perl6 t/bail.t
Too many positionals passed; expected 1 argument but got 2
in sub bail-out at
/Applications/Rakudo/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E
(Test) line 257
in block <unit> at t/bail.t line 4

Running it in https://glot.io/new/perl6 shows the same thing.

Besides the actual error, the error message isn't great. I would have
liked it to mention the method name and class causing the problem.

This is​:

$ perl6 -v
This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented May 31, 2017

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

@p6rt
Copy link
Author

p6rt commented May 31, 2017

From @zoffixznet

On Wed, 31 May 2017 02​:45​:07 -0700, elizabeth wrote​:

tests needed.

Tests added​: Raku/roast@83e984a190

On 31 May 2017, at 07​:20, brian d foy (via RT) <perl6-bugs-followup@​perl.org> wrote​:

Besides the actual error, the error message isn't great. I would have
liked it to mention the method name and class causing the problem.

I'll ping MasterDuke about this. Perhaps the same improvement that was recently done to :D method calls can be applied here. Renaming the ticket to point out that problem.

@p6rt
Copy link
Author

p6rt commented May 31, 2017

From @MasterDuke17

The error now includes the name of the routine.

Implemented (with some tests) in rakudo/rakudo#1093

@p6rt
Copy link
Author

p6rt commented May 31, 2017

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

@p6rt p6rt closed this as completed May 31, 2017
@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
usev6 added a commit to usev6/rakudo that referenced this issue Dec 18, 2021
usev6 added a commit to rakudo/rakudo that referenced this issue Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant