diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-07-19 09:45:24 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-07-19 09:45:24 +0000 |
commit | f2f96cd564e6a3029bcc2182ffccc4f92f518fb6 (patch) | |
tree | caf8b5abe1c7c84a02606d32a190802119b0f3c5 /t | |
parent | 0f1f2428e1f9e9aa05108acb4c8ec2a0a83d728e (diff) | |
download | perl-f2f96cd564e6a3029bcc2182ffccc4f92f518fb6.tar.gz |
Overhaul the semantics of the warning
""%s" variable %s masks earlier declaration",
based on a patch by Rick Delaney. Now we have :
my $x; my $x; # warns
my $x; our $x; # warns
our $x; my $x; # warns
our $x; our $x; # silent
p4raw-id: //depot/perl@25179
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/pad | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/t/lib/warnings/pad b/t/lib/warnings/pad index f0dce60caa..f25452f81a 100644 --- a/t/lib/warnings/pad +++ b/t/lib/warnings/pad @@ -33,51 +33,70 @@ use warnings 'misc' ; my $x ; my $x ; my $y = my $y ; +my $p ; +package X ; +my $p ; +package main ; no warnings 'misc' ; my $x ; my $y ; +my $p ; EXPECT "my" variable $x masks earlier declaration in same scope at - line 4. "my" variable $y masks earlier declaration in same statement at - line 5. +"my" variable $p masks earlier declaration in same scope at - line 8. ######## # pad.c use warnings 'misc' ; our $x ; our $x ; our $y = our $y ; -no warnings 'misc' ; -our $x ; -our $y ; +our $p ; +package X ; +our $p ; EXPECT -"our" variable $x masks earlier declaration in same scope at - line 4. -"our" variable $y masks earlier declaration in same statement at - line 5. ######## # pad.c use warnings 'misc' ; our $x ; my $x ; our $y = my $y ; +our $p ; +package X ; +my $p ; +package main ; no warnings 'misc' ; our $z ; my $z ; our $t = my $t ; +our $q ; +package X ; +my $q ; EXPECT "my" variable $x masks earlier declaration in same scope at - line 4. "my" variable $y masks earlier declaration in same statement at - line 5. +"my" variable $p masks earlier declaration in same scope at - line 8. ######## # pad.c -# TODO not implemented yet use warnings 'misc' ; my $x ; our $x ; my $y = our $y ; +my $p ; +package X ; +our $p ; +package main ; no warnings 'misc' ; my $z ; our $z ; my $t = our $t ; +my $q ; +package X ; +our $q ; EXPECT -"our" variable $x masks earlier declaration in same scope at - line 5. -"our" variable $y masks earlier declaration in same statement at - line 6. +"our" variable $x masks earlier declaration in same scope at - line 4. +"our" variable $y masks earlier declaration in same statement at - line 5. +"our" variable $p masks earlier declaration in same scope at - line 8. ######## # pad.c use warnings 'closure' ; @@ -219,6 +238,13 @@ EXPECT ######## use warnings 'misc' ; +my $x; +{ + my $x; +} +EXPECT +######## +use warnings 'misc' ; our $x; { our $x; @@ -227,6 +253,20 @@ EXPECT "our" variable $x redeclared at - line 4. (Did you mean "local" instead of "our"?) ######## +use warnings 'misc' ; +our $x; +{ + my $x; +} +EXPECT +######## +use warnings 'misc' ; +my $x; +{ + our $x; +} +EXPECT +######## # an our var being introduced should suppress errors about global syms use strict; use warnings; |