summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-22 05:40:18 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-08-24 19:02:56 -0700
commite4916dd1b37bf1a38d4b4711efc268f2ddfca52f (patch)
tree33d3eb5ea90b8d67040fdfdcc1af975f11fb2acd /t
parentf393a21acd390a2084b262b82d021c5a00ddecd1 (diff)
downloadperl-e4916dd1b37bf1a38d4b4711efc268f2ddfca52f.tar.gz
[perl #80368] Fix implicit assignop in qq"a\U="
The bug report explains it all: > $ perl -e 'print "a\U="' > Can't modify constant item in concatenation (.) or string at -e line 1, near "print "a\U="" > Execution of -e aborted due to compilation errors. > > The "a\U=" string constant ought to generate ops corresponding roughly to > "a".uc("=") (which would then be constant-folded). However, the "=" is > being interpreted by the tokeniser as part of the concatenation operator, > producing ops corresponding to "a".=uc("") (which generates the error). > > This happens because the implicit concatenation operator is generated > in toke.c via the Aop() macro, which allows an addition-type operator > to be mutated into an assignment operator if it is immediately followed > by an "=". It should instead be generated via one of the other macros, > or possibly a new macro, that doesn't allow for mutation to an assignment > operator. This commit does the latter. > There are multiple sites in toke.c making the same mistake. The other two instances are harmless, but the next commit will change them for a different reason (avoiding unnecessary PL_expect assign- ments with a view to eventually removing PL_lex_expect).
Diffstat (limited to 't')
-rw-r--r--t/base/lex.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index 01ab2088b0..d75fa57b8f 100644
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..91\n";
+print "1..92\n";
$x = 'x';
@@ -434,3 +434,7 @@ print "ok $test - y <comment> <newline> ...\n"; $test++;
print "not " unless (time
=>) eq time=>;
print "ok $test - => quotes keywords across lines\n"; $test++;
+
+# [perl #80368]
+print "not " unless eval '"a\U="' eq "a=";
+print "ok $test - [perl #80368] qq <a\\U=>\n"; $test++;