In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a7e260e62a5e47961e908363da32ef16f41301b2?hp=044d64a877be884e81013d53b56accbddfe731cc>
- Log ----------------------------------------------------------------- commit a7e260e62a5e47961e908363da32ef16f41301b2 Author: Rafael Garcia-Suarez <[email protected]> Date: Fri Apr 23 11:42:05 2010 +0200 Deprecation warnings should always be mandatory since 5.12.0 M toke.c commit c4deb7365787eb01845a9d0e371e343169530659 Author: Rafael Garcia-Suarez <[email protected]> Date: Fri Apr 23 11:39:58 2010 +0200 Fix tests and add one more test for the deprecation warning added in last change M t/lib/warnings/toke commit 6fb472bab4fadd0ae2ca9624b74596afab4fb8cb Author: James Mastros <[email protected]> Date: Fri Apr 23 11:35:28 2010 +0200 New deprecation warning: Dot after %s literal is concatenation M pod/perldiag.pod M t/lib/warnings/toke M toke.c ----------------------------------------------------------------------- Summary of changes: pod/perldiag.pod | 11 +++++++++++ t/lib/warnings/toke | 18 ++++++++++++++++++ toke.c | 9 +++++++++ 3 files changed, 38 insertions(+), 0 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index edccac1..fe9be76 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1524,6 +1524,17 @@ you called it with no args and both C<$@> and C<$_> were empty. See Server error. +=item Dot after %s literal is concatenation + +(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 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, +everything above applies to octal and binary constants, too.) + =item %s does not define %s::VERSION--version check failed (F) You said something like "use Module 42" but the Module did not diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 2236442..81cf246 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -960,3 +960,21 @@ Use of := for an empty attribute list is deprecated at - line 36. Use of := for an empty attribute list is deprecated at - line 38. Use of := for an empty attribute list is deprecated at - line 41. Use of := for an empty attribute list is deprecated at - line 42. +######## +# toke.c +use warnings 'deprecated'; +my $a = 0123.456; +my $b = 0x123.456; +my $c = 0b101.010; +my $d = 0123 . 456; +no warnings 'deprecated'; +my $e = 0765.432; +EXPECT +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; +my @c = 0x123..0x456; +EXPECT diff --git a/toke.c b/toke.c index b5236da..0cc3fb8 100644 --- a/toke.c +++ b/toke.c @@ -13117,6 +13117,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) -- Perl5 Master Repository
