Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[perl #127877] Emit undef warning on sassign+concat
Code like this: my $x; $x .= 'a'; is specifically exempted from "use of uninitialized value" warnings, according to the "Declarations" section of perlsyn, to allow the idiom of building up a value piecemeal. The same is true of the += and -= operators. However, breaking the combined assignment up into the underlying operator and a simple assignment, as in this code: my $x; $x = $x . 'a'; *should* produce a warning. That warning was correctly being emitted for addition and subtraction, but concatenation was behaving as the ".=" case, because "$x = $x . EXPR" is optimized to the equivalent of "$x .= EXPR". So we now explicitly detect this case, and emit the desired warning.
- Loading branch information