summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFelipe Gasper <felipe@felipegasper.com>2020-12-29 03:22:40 -0500
committerKarl Williamson <khw@cpan.org>2021-01-03 08:46:31 -0700
commit0f14f058b16bfb27c6240d4ea745a895c7e6dd28 (patch)
tree78b0d26adc2a4109b393be623b0510b6787a9d48 /pp.c
parent7f02c1397bd1a1ff685776c0bde8d553793c031d (diff)
downloadperl-0f14f058b16bfb27c6240d4ea745a895c7e6dd28.tar.gz
Signatures: add argument counts to count-mismatch error messages.
Issue #18405
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c15
1 files changed, 11 insertions, 4 deletions
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' */