diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-08-08 22:23:29 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-09-03 12:55:23 +0200 |
commit | 2b7cdddeb97baa9e06d2bd4f7931d608e8dde565 (patch) | |
tree | fa43a207f5dabe54518476da087c496843257ec6 /op.c | |
parent | 2d4e17002f84f407fd95e491979a0bafccc2a0f8 (diff) | |
download | perl-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); } |