summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-05-15 13:36:00 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-05-16 20:22:02 -0700
commit69e7f50e50fca481754ecdbf99128ec510592c89 (patch)
tree2c3f7e84382ff6a2adf3d2efd4b0e3105689a6fb
parentdc26b617fb7e7efe5ade0b25317c4133355b1cab (diff)
downloadperl-69e7f50e50fca481754ecdbf99128ec510592c89.tar.gz
[perl #127976] Restore ‘or array’ to each($s) err
This part of the message was accidentally deleted when the autoderef feature was introduced. This commit also emits this error in addition to the ‘Experimental forbidden’ message in those cases where the latter occurs, since it makes things clearer.
-rw-r--r--op.c5
-rw-r--r--t/lib/croak/op6
-rw-r--r--t/op/smartkve.t3
3 files changed, 8 insertions, 6 deletions
diff --git a/op.c b/op.c
index 260914e1b5..cad8237f3f 100644
--- a/op.c
+++ b/op.c
@@ -11954,12 +11954,13 @@ Perl_ck_each(pTHX_ OP *o)
|| ( SvTYPE(SvRV(cSVOPx_sv(kid))) != SVt_PVAV
&& SvTYPE(SvRV(cSVOPx_sv(kid))) != SVt_PVHV )
)
- /* we let ck_fun handle it */
- break;
+ goto bad;
default:
yyerror_pv(Perl_form(aTHX_
"Experimental %s on scalar is now forbidden",
PL_op_desc[orig_type]), 0);
+ bad:
+ bad_type_pv(1, "hash or array", o, kid);
return o;
}
}
diff --git a/t/lib/croak/op b/t/lib/croak/op
index cd3a6544e3..6e19ff8dda 100644
--- a/t/lib/croak/op
+++ b/t/lib/croak/op
@@ -137,17 +137,17 @@ Execution of - aborted due to compilation errors.
# NAME keys BAREWORD
@a = keys FRED ;
EXPECT
-Type of arg 1 to keys must be hash (not constant item) at - line 1, near "FRED ;"
+Type of arg 1 to keys must be hash or array (not constant item) at - line 1, near "FRED ;"
Execution of - aborted due to compilation errors.
########
# NAME values BAREWORD
@a = values FRED ;
EXPECT
-Type of arg 1 to values must be hash (not constant item) at - line 1, near "FRED ;"
+Type of arg 1 to values must be hash or array (not constant item) at - line 1, near "FRED ;"
Execution of - aborted due to compilation errors.
########
# NAME each BAREWORD
@a = each FRED ;
EXPECT
-Type of arg 1 to each must be hash (not constant item) at - line 1, near "FRED ;"
+Type of arg 1 to each must be hash or array (not constant item) at - line 1, near "FRED ;"
Execution of - aborted due to compilation errors.
diff --git a/t/op/smartkve.t b/t/op/smartkve.t
index fdd886ed14..f092a8c133 100644
--- a/t/op/smartkve.t
+++ b/t/op/smartkve.t
@@ -19,7 +19,8 @@ sub set_errpat {
# yyerror for the error, rather than croak. yyerror is preferable for
# compile-time errors.
$errpat =
- qr/Experimental $_[0] on scalar is now forbidden .* line 1,/;
+ qr/Experimental $_[0] on scalar is now forbidden .* line 1,(?x:
+ ).*Type of arg 1 to $_[0] must be hash or array \(not /s;
}
# Keys -- errors