Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pad
index 65f92c3..bf5c367 100644 (file)
@@ -1,6 +1,6 @@
   pad.c                AOK
 
-     "my" variable %s masks earlier declaration in same scope
+     "%s" variable %s masks earlier declaration in same scope
        my $x;
        my $x ;
 
@@ -33,12 +33,60 @@ 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 ;
+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
+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 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' ;
@@ -149,6 +197,25 @@ f()->();
 EXPECT
 Variable "$x" is not available at (eval 1) line 2.
 ########
+use warnings 'closure' ;
+{
+    my $x = 1;
+    $y = \$x; # force abandonment rather than clear-in-place at scope exit
+    sub f2 { eval '$x' }
+}
+f2();
+EXPECT
+Variable "$x" is not available at (eval 1) line 2.
+########
+use warnings 'closure' ;
+for my $x (1,2,3) {
+    sub f { eval '$x' }
+    f();
+}
+f();
+EXPECT
+Variable "$x" is not available at (eval 4) line 2.
+########
 # pad.c
 no warnings 'closure' ;
 sub x {
@@ -161,13 +228,84 @@ EXPECT
 
 ########
 use warnings 'misc' ;
+my $x;
+{
+    my $x;
+}
+EXPECT
+########
+# pad.c
+use warnings 'misc' ;
+our $x ;
+our $x ;
+our $y = our $y ;
+our $p ;
+package X ;
+our $p ;
+package main ;
+no warnings 'misc' ;
+our $a ;
+our $a ;
+our $b = our $b ;
+our $c ;
+package X ;
+our $c ;
+EXPECT
+"our" variable $x redeclared at - line 4.
+"our" variable $y redeclared at - line 5.
+########
+use warnings 'misc' ;
 our $x;
 {
     our $x;
 }
+our $x;
+no warnings 'misc' ;
+our $y;
+{
+    our $y;
+}
+our $y;
 EXPECT
 "our" variable $x redeclared at - line 4.
        (Did you mean "local" instead of "our"?)
+"our" variable $x redeclared at - line 6.
+########
+use warnings 'misc' ;
+our $x;
+{
+    my $x;
+}
+no warnings 'misc' ;
+our $y;
+{
+    my $y;
+}
+EXPECT
+########
+use warnings 'misc' ;
+my $x;
+{
+    our $x;
+}
+no warnings 'misc' ;
+my $y;
+{
+    our $y;
+}
+EXPECT
+########
+use warnings 'misc' ;
+my $x;
+{
+    my $x;
+}
+no warnings 'misc' ;
+my $y;
+{
+    my $y;
+}
+EXPECT
 ########
 # an our var being introduced should suppress errors about global syms
 use strict;