From 0f14f058b16bfb27c6240d4ea745a895c7e6dd28 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Dec 2020 03:22:40 -0500 Subject: Signatures: add argument counts to count-mismatch error messages. Issue #18405 --- pp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pp.c') diff --git a/pp.c b/pp.c index 23cc6c8adb..d0e639fa32 100644 --- a/pp.c +++ b/pp.c @@ -7151,10 +7151,17 @@ PP(pp_argcheck) too_few = (argc < (params - opt_params)); if (UNLIKELY(too_few || (!slurpy && argc > params))) - /* diag_listed_as: Too few arguments for subroutine '%s' */ - /* diag_listed_as: Too many arguments for subroutine '%s' */ - Perl_croak_caller("Too %s arguments for subroutine '%" SVf "'", - too_few ? "few" : "many", S_find_runcv_name()); + + /* diag_listed_as: Too few arguments for subroutine '%s' (got %d; expected %d) */ + /* diag_listed_as: Too few arguments for subroutine '%s' (got %d; expected at least %d) */ + /* diag_listed_as: Too many arguments for subroutine '%s' (got %d; expected %d) */ + /* diag_listed_as: Too many arguments for subroutine '%s' (got %d; expected at most %d)*/ + Perl_croak_caller("Too %s arguments for subroutine '%" SVf "' (got %" UVuf "; expected %s%" UVuf ")", + too_few ? "few" : "many", + S_find_runcv_name(), + argc, + too_few ? (slurpy || opt_params ? "at least " : "") : (opt_params ? "at most " : ""), + too_few ? (params - opt_params) : params); if (UNLIKELY(slurpy == '%' && argc > params && (argc - params) % 2)) /* diag_listed_as: Odd name/value argument for subroutine '%s' */ -- cgit v1.2.1