summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-08-08 22:23:29 +0200
committerNicholas Clark <nick@ccl4.org>2012-09-03 12:55:23 +0200
commit2b7cdddeb97baa9e06d2bd4f7931d608e8dde565 (patch)
treefa43a207f5dabe54518476da087c496843257ec6 /op.c
parent2d4e17002f84f407fd95e491979a0bafccc2a0f8 (diff)
downloadperl-2b7cdddeb97baa9e06d2bd4f7931d608e8dde565.tar.gz
Test that the warning for "Found = in conditional" is for the start line.
The Perl interpreter is careful to use the line number of the start of the "Found = in conditional", but there were no tests for this.
Diffstat (limited to 'op.c')
-rw-r--r--op.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/op.c b/op.c
index 744ddd9f5e..9b7b84edea 100644
--- a/op.c
+++ b/op.c
@@ -1085,8 +1085,11 @@ S_scalarboolean(pTHX_ OP *o)
if (ckWARN(WARN_SYNTAX)) {
const line_t oldline = CopLINE(PL_curcop);
- if (PL_parser && PL_parser->copline != NOLINE)
+ if (PL_parser && PL_parser->copline != NOLINE) {
+ /* This ensures that warnings are reported at the first line
+ of the conditional, not the last. */
CopLINE_set(PL_curcop, PL_parser->copline);
+ }
Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "Found = in conditional, should be ==");
CopLINE_set(PL_curcop, oldline);
}