From: Jesse Vincent Date: Wed, 5 May 2010 18:35:25 +0000 (-0400) Subject: Revert "tweak "0x123.456" deprecation" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7186b0badf2e072222edb463867230cf8820e369;p=p5sagit%2Fp5-mst-13.2.git Revert "tweak "0x123.456" deprecation" This reverts commit 1183a10042af0734ee65e252f15bd820b7bbe686. Zefram asked me to revert this as he's going to be doing something more pluggable --- diff --git a/MANIFEST b/MANIFEST index 2e2112b..9dc1906 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4188,7 +4188,6 @@ t/cmd/mod.t See if statement modifiers work t/cmd/subval.t See if subroutine values work t/cmd/switch.t See if switch optimizations work t/cmd/while.t See if while loops work -t/comp/binary_num.t See if bin/oct/hex numbers are parsed right t/comp/bproto.t See if builtins conform to their prototypes t/comp/cmdopt.t See if command optimization works t/comp/colon.t See if colons are parsed correctly diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 1d3b55c..6d6322a 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1534,13 +1534,12 @@ you called it with no args and both C<$@> and C<$_> were empty. See Server error. -=item Dot after %s literal is deprecated concatenation +=item Dot after %s literal is concatenation -(D deprecated, syntax) You had something like 0x123.456 in your code. -This is currently +(D) You had something like 0x123.456 in your code. This is currently parsed as the hexadecimal number 0x123 concatenated with the decimal -number 456, not the fraction 0x123 + 0x456/0x1000 -- we only support decimal -fractions. If you meant it to be a fraction, you'll need to use +number 456, not 0x123 + 0x456/0x1000 -- we only support decimal +decimal points. If you meant it to be a fraction, you'll need to use Math::BigFloat's from_hex (or friends). If you meant it to be concatenation, just put spaces around the dot to make it clearer. In 5.14.0, we expect to change this to mean a hex fraction. (Of course, diff --git a/t/comp/binary_num.t b/t/comp/binary_num.t deleted file mode 100644 index 91fb001..0000000 --- a/t/comp/binary_num.t +++ /dev/null @@ -1,36 +0,0 @@ -#!./perl - -print "1..30\n"; -my $test_num = 0; -sub ok { - print $_[0] ? "" : "not ", "ok ", ++$test_num, "\n"; -} - -sub do_test { - my($src, $expect_value, $match_warning) = @_; - my($value, $warning); - local $SIG{__WARN__} = sub { $warning .= $_[0] }; - $value = eval($src); - ok defined($expect_value) ? $value == $expect_value : !defined($value); - ok $warning =~ $match_warning; -} - -do_test "0x123", 291, qr/\A\z/; -do_test "0x123.8", 2918, qr/\ADot after hexadecimal literal is deprecated /; -do_test "0x123 .8", 2918, qr/\A\z/; -do_test "0x123. 8", 2918, qr/\ADot after hexadecimal literal is deprecated /; -do_test "[0x123..8] && 5", 5, qr/\A\z/; - -do_test "0123", 83, qr/\A\z/; -do_test "0123.4", 834, qr/\ADot after octal literal is deprecated /; -do_test "0123 .4", 834, qr/\A\z/; -do_test "0123. 4", 834, qr/\ADot after octal literal is deprecated /; -do_test "[0123..4] && 5", 5, qr/\A\z/; - -do_test "0b101", 5, qr/\A\z/; -do_test "0b101.1", 51, qr/\ADot after binary literal is deprecated /; -do_test "0b101 .1", 51, qr/\A\z/; -do_test "0b101. 1", 51, qr/\ADot after binary literal is deprecated /; -do_test "[0b101..1] && 5", 5, qr/\A\z/; - -1; diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index ae097de..81cf246 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -970,9 +970,9 @@ my $d = 0123 . 456; no warnings 'deprecated'; my $e = 0765.432; EXPECT -Dot after octal literal is deprecated concatenation at - line 3. -Dot after hexadecimal literal is deprecated concatenation at - line 4. -Dot after binary literal is deprecated concatenation at - line 5. +Dot after octal literal is concatenation at - line 3. +Dot after hexadecimal literal is concatenation at - line 4. +Dot after binary literal is concatenation at - line 5. ######## # toke.c use warnings; diff --git a/t/op/taint.t b/t/op/taint.t index 8aeaea1..e3a5712 100644 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -393,7 +393,7 @@ SKIP: { # Operations which affect directories can't use tainted data. { - test !eval { mkdir "foo".$TAINT, (0755).$TAINT0 }, 'mkdir'; + test !eval { mkdir "foo".$TAINT, 0755.$TAINT0 }, 'mkdir'; test $@ =~ /^Insecure dependency/, $@; test !eval { rmdir $TAINT }, 'rmdir'; diff --git a/toke.c b/toke.c index e9841f8..03e9d03 100644 --- a/toke.c +++ b/toke.c @@ -13014,18 +13014,6 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp) switch (*s) { - case '.': - /* Dot here is historically concat, not a radix point. - Deprecate that; it's confusing, and gets in the way of - hex(ish) fractions... but '..' is OK. */ - if (s[1] != '.') { - Perl_ck_warner_d(aTHX_ - packWARN2(WARN_DEPRECATED, WARN_SYNTAX), - "Dot after %s literal is deprecated concatenation", - base); - } - /* FALL THROUGH */ - /* if we don't mention it, we're done */ default: goto out; @@ -13108,6 +13096,15 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp) Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX), "Misplaced _ in number"); } + /* Dot here is historically concat, not a radix point. + Deprecate that; it's confusing, and gets in the way of + hex(ish) fractions... but '..' is OK. */ + if (s[0] == '.' && + s[1] != '.') { + Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), + "Dot after %s literal is concatenation", base); + } + sv = newSV(0); if (overflowed) { if (n > 4294967295.0)