This is a follow-up to
69e7f50e50.
69e7f50e50 resulted in yyerror
being called twice for the same error, resulting in double diagnos-
tics for where the error occurred:
$ ./perl -e 'keys $scalar, $1'
Experimental keys on scalar is now forbidden at -e line 1, near "$scalar,"
Type of arg 1 to keys must be hash or array (not scalar dereference) at -e line 1, near "$scalar,"
Execution of -e aborted due to compilation errors.
We don’t need ‘near "$scalar,"’ twice.
For the first one we should queue the error directly, using qerror()
(which yyerror itself normally calls), so we don’t get double
diagnostics.
)
goto bad;
default:
- yyerror_pv(Perl_form(aTHX_
+ qerror(Perl_mess(aTHX_
"Experimental %s on scalar is now forbidden",
- PL_op_desc[orig_type]), 0);
+ PL_op_desc[orig_type]));
bad:
bad_type_pv(1, "hash or array", o, kid);
return o;
# 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,(?x:
- ).*Type of arg 1 to $_[0] must be hash or array \(not /s;
+ qr/Experimental $_[0] on scalar is now forbidden .* line 1\.(?x:
+ ).*Type of arg 1 to $_[0] must be hash or array \(not (?x:
+ ).*line 1,/s;
}
# Keys -- errors