Skip to content

Commit 3a9c80e

Browse files
committed
fixup use croak_caller() to report correct caller line number
1 parent 0c1bb85 commit 3a9c80e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8045,7 +8045,7 @@ PP(pp_multiparam)
80458045
else {
80468046
// TODO: Consider collecting up all the names of unrecognised
80478047
// in one string
8048-
croak("Unrecognized named parameter '%s' to subroutine '%" SVf "'",
8048+
croak_caller("Unrecognized named parameter '%s' to subroutine '%" SVf "'",
80498049
namepv, S_find_runcv_name());
80508050
}
80518051
}
@@ -8057,7 +8057,7 @@ PP(pp_multiparam)
80578057

80588058
// TODO: Consider collecting up all the names of missing
80598059
// parameters in one string
8060-
croak("Missing required named parameter '%s' to subroutine '%" SVf "'",
8060+
croak_caller("Missing required named parameter '%s' to subroutine '%" SVf "'",
80618061
named->namepv, S_find_runcv_name());
80628062
}
80638063
}

t/lib/croak/signatures

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,17 @@ Can't use global %_ in subroutine signature at - line 2, near "(%_"
250250
sub t101 ($1) { }
251251
EXPECT
252252
Illegal operator following parameter in a subroutine signature at - line 2, near "($1"
253+
########
254+
# NAME missing required named
255+
no warnings 'experimental::signature_named_parameters';
256+
sub f (:$alpha, :$beta) { } ## line 3
257+
f(alpha => 123); ## line 4
258+
EXPECT
259+
Missing required named parameter 'beta' to subroutine 'main::f' at - line 4.
260+
########
261+
# NAME unrecognised named
262+
no warnings 'experimental::signature_named_parameters';
263+
sub f (:$alpha) { } ## line 3
264+
f(alpha => 123, gamma => 456); ## line 4
265+
EXPECT
266+
Unrecognized named parameter 'gamma' to subroutine 'main::f' at - line 4.

0 commit comments

Comments
 (0)