Branch: refs/heads/smoke-me/mauke/warn-not-vs-cmp
Home: https://github.com/Perl/perl5
Commit: ed307856dd78fc4e3139c9cbf8de379437c9e5cd
https://github.com/Perl/perl5/commit/ed307856dd78fc4e3139c9cbf8de379437c9e5cd
Author: Lukas Mai <[email protected]>
Date: 2024-08-15 (Thu, 15 Aug 2024)
Changed paths:
M embed.h
M op.c
M opcode.h
M pod/perldiag.pod
M proto.h
M regen/opcodes
M t/lib/warnings/op
Log Message:
-----------
warn about !$x == $y, !$x =~ /abc/, and similar constructs
Commit 2f48e46b3f6d2d introduced a warning for logical negation as the
left operand of the `isa` operator, which likely indicates a precedence
problem (i.e. the programmer wrote `! $x isa $y` when they probably
meant `!($x isa $y)`).
This commit extends the warning to all (in)equality comparisons (`==`,
`!=`, `<`, `>`, `<=`, `>=`, `eq`, `ne`, `lt`, `gt`, `le`, `ge`) as well
as binding operations (`=~`, `!~`).
As an indication that such a warning is useful in the real world, the
core currently contains two files with (likely broken) code that
triggers this warning:
- ./cpan/Test-Simple/lib/Test2/Hub.pm
- ./cpan/Scalar-List-Utils/t/uniqnum.t
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications