Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend "Possible precedence issue" warning, cover more cases
Previously, code like return $a or $b; would emit a warning of the form "Possible precedence issue with control flow operator" because it parses as (return $a) or $b. However, the equally misleading exit $a != 0; # exit($a) != 0 exit $a ? 0 : $b; # exit($a) ? 0 : $b were not diagnosed. This patch moves the check higher up in the compiler: Now any binary or ternary operator (not just logical operators) warns if its first operand is an unparenthesized control flow operator that does not terminate normally (i.e. next, last, redo, goto, exit, return, die).
- Loading branch information
Showing
2 changed files
with
77 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters