diff options
author | Father Chrysostomos <sprout@cpan.org> | 2016-08-16 11:22:46 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2016-08-17 06:20:27 -0700 |
commit | 9dcfb888e52104c4c92e8c35a6ccfabc6c46e96c (patch) | |
tree | f18644212db36397074dc76d9c7cc96276daaad9 /t/base | |
parent | 89bfd824260d1b31d8f48e0c38e8ad89bf285b4b (diff) | |
download | perl-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.t | 15 |
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++; |