summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-06 21:57:39 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-06 22:26:33 -0700
commitee36fb64514b5be225fa71afa0a6fb4414e469b1 (patch)
treec56f4a8c88d69c530eb12d76da4a7d79b50635e2 /t/comp
parent39c012bc2fc2f1cf310f6d4ba499ec58a7bad900 (diff)
downloadperl-ee36fb64514b5be225fa71afa0a6fb4414e469b1.tar.gz
[perl #113016] Parse CORE::foo::bar as a bareword
CORE::print::foo was being parsed as CORE::print followed by ::foo, making it impossible to call a global override directly as CORE::GLOBAL::uc(). The logic in toke.c that does the CORE:: special-casing was faulty. This commit fixes it, by checking for a package separator after the potential keyword. That d = s part of the KEY_CORE case in yylex was added in perl 5.001 (748a9306) but apparently wasn’t doing anything. That means I get to move it before s+=2, now that I have a use for it. I added the tests a little above the ‘Add new tests HERE’ label in parser.t, to avoid conflicting with other patches I’m working on.
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/parser.t8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index c0fc24602b..9ae7b75d78 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -3,7 +3,7 @@
# Checks if the parser behaves correctly in edge cases
# (including weird syntax errors)
-print "1..135\n";
+print "1..137\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -348,6 +348,12 @@ like($@, qr/BEGIN failed--compilation aborted/, 'BEGIN 7' );
is(defined &zlonk, '', 'but no body defined');
}
+# [perl #113016] CORE::print::foo
+sub CORE'print'foo { 43 } # apostrophes intentional; do not tempt fate
+sub CORE'foo'bar { 43 }
+is CORE::print::foo, 43, 'CORE::print::foo is not CORE::print ::foo';
+is scalar eval "CORE::foo'bar", 43, "CORE::foo'bar is not an error";
+
# bug #71748
eval q{
$_ = "";