summaryrefslogtreecommitdiff
path: root/t/base
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-08-16 11:22:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-08-17 06:20:27 -0700
commit9dcfb888e52104c4c92e8c35a6ccfabc6c46e96c (patch)
treef18644212db36397074dc76d9c7cc96276daaad9 /t/base
parent89bfd824260d1b31d8f48e0c38e8ad89bf285b4b (diff)
downloadperl-9dcfb888e52104c4c92e8c35a6ccfabc6c46e96c.tar.gz
Test that the lexer does not upgrade constants
Make sure that if two barewords occur in a row the lexer does not upgrade the corresponding symbol table entries into full GVs. c82de78e was a bug fix, but it also made things more efficient. Test that we do not lose that efficiency by mistake.
Diffstat (limited to 't/base')
-rw-r--r--t/base/lex.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index 4ac2b5bc53..87eb0e4a3c 100644
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..107\n";
+print "1..109\n";
$x = 'x';
@@ -535,3 +535,16 @@ print qq|ok $test - [perl #128478] "\$foo::\$bar"\n|; $test++;
@bar = ("baz","bonk");
print "not " unless "$foo::@bar" eq "barbaz bonk";
print qq|ok $test - [perl #128478] "\$foo::\@bar"\n|; $test ++;
+
+# Test that compilation of tentative indirect method call syntax which
+# turns out not to be such does not upgrade constants to full globs in the
+# symbol table.
+sub fop() { 0 }
+sub bas() { 0 }
+{ local $SIG{__WARN__}=sub{}; eval 'fop bas'; }
+print "not " unless ref $::{fop} eq 'SCALAR';
+print "ok $test - first constant in 'const1 const2' is not upgraded\n";
+$test++;
+print "not " unless ref $::{bas} eq 'SCALAR';
+print "ok $test - second constant in 'const1 const2' is not upgraded\n";
+$test++;