diff options
author | Aaron Crane <arc@cpan.org> | 2016-05-15 19:00:53 +0100 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2016-05-15 20:19:21 +0100 |
commit | 2e6807b5b9d6bff0efdfbbed7b7731e04ea21273 (patch) | |
tree | c3d2b34c24f3facaa596f5f4f2c27fee8941d9b5 /t/lib/warnings/2use | |
parent | 1ec2b028f490cff41b7f0c1131c900b58431c722 (diff) | |
download | perl-2e6807b5b9d6bff0efdfbbed7b7731e04ea21273.tar.gz |
Make barewords constant-foldable
Commit 11fa937b2766784f0f812687a7f81dd3761e605f, from August 1999, changed
constant folding to treat barewords as unfoldable. Public mailing-list
archives from that period are incomplete, unfortunately, and this change in
particular is no longer well documented; the only message still available
seems to be <199907140903.CAA07505@activestate.com>, with subject "Re:
Unwanted perl helpfullness". That message quotes a bug reporter pointing out
that a constant-folded bareword would fail to trigger the "not allowed while
strict subs in use" error under "use strict".
However, there's no information available about why the bug was fixed in this
way, rather than by merely ensuring that constant folding would produce that
error when necessary. The no_bareword_allowed() routine did already exist at
that point, for example. This change therefore adopts that approach.
This causes one minor change in behaviour: since barewords now take part in
constant folding, concatenating a bareword with another constant in void
context now produces a warning for the concatenated string, rather than for
the concatenation op. This seems like an acceptable change, given that
non-bareword constants already behave in the same way.
Diffstat (limited to 't/lib/warnings/2use')
-rw-r--r-- | t/lib/warnings/2use | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/lib/warnings/2use b/t/lib/warnings/2use index c0d203a399..4e10d4b73d 100644 --- a/t/lib/warnings/2use +++ b/t/lib/warnings/2use @@ -76,7 +76,7 @@ Reversed += operator at - line 3. no warnings 'reserved' ; foo.bar; EXPECT -Useless use of concatenation (.) or string in void context at - line 3. +Useless use of a constant ("foobar") in void context at - line 3. ######## --FILE-- abc |