Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / op
index e06d251..8dadc7a 100644 (file)
@@ -525,6 +525,10 @@ Useless use of a variable in void context at - line 6.
 use warnings 'void' ;
 "abc"; # OP_CONST
 7 ; # OP_CONST
+5 || print "bad\n";    # test OPpCONST_SHORTCIRCUIT
+use constant U => undef;
+print "boo\n" if U;    # test OPpCONST_SHORTCIRCUIT
+$[ = 2; # should not warn
 no warnings 'void' ;
 "abc"; # OP_CONST
 7 ; # OP_CONST
@@ -584,6 +588,7 @@ BEGIN not safe after errors--compilation aborted at - line 18.
 use warnings 'parenthesis' ;
 my $a, $b = (1,2);
 my @foo,%bar,  $quux; # there's a TAB here
+my $x, $y or print;
 no warnings 'parenthesis' ;
 my $c, $d = (1,2);
 EXPECT
@@ -675,6 +680,7 @@ Value of readdir() operator can be "0"; test with defined() at - line 4.
 ########
 # op.c
 use warnings 'misc';
+use feature 'err';
 open FH, "<abc";
 $_ = <FH> err $_ = 1;
 ($_ = <FH>) // ($_ = 1);
@@ -1018,6 +1024,7 @@ local(pos($x));           # OP_POS
 local(vec($x,0,1));    # OP_VEC
 local($a[$b]);         # OP_AELEM              ok
 local($a{$b});         # OP_HELEM              ok
+local($[);             # OP_CONST
 
 no warnings 'syntax';
 EXPECT
@@ -1049,3 +1056,48 @@ Useless localization of defined or assignment (//=) at - line 45.
 Useless localization of substr at - line 48.
 Useless localization of match position at - line 49.
 Useless localization of vec at - line 50.
+########
+# op.c
+use warnings 'deprecated';
+my $x1 if 0;
+my @x2 if 0;
+my %x3 if 0;
+my ($x4) if 0;
+my ($x5,@x6, %x7) if 0;
+0 && my $z1;
+0 && my (%z2);
+# these shouldn't warn
+our $x if 0;
+our $x unless 0;
+if (0) { my $w1 }
+if (my $w2) { $a=1 }
+if ($a && (my $w3 = 1)) {$a = 2}
+
+EXPECT
+Deprecated use of my() in false conditional at - line 3.
+Deprecated use of my() in false conditional at - line 4.
+Deprecated use of my() in false conditional at - line 5.
+Deprecated use of my() in false conditional at - line 6.
+Deprecated use of my() in false conditional at - line 7.
+Deprecated use of my() in false conditional at - line 8.
+Deprecated use of my() in false conditional at - line 9.
+########
+# op.c
+use feature 'state';
+use warnings 'misc';
+state($x) = 1;
+(state $y) = 2;
+(state $z, my $t) = (3, 4);
+(state $foo, state $bar) = (5, 6);
+(undef, my $v, state $w) = (7 .. 9);
+no warnings 'misc';
+state($x) = 1;
+(state $y) = 2;
+(state $z, my $t) = (3, 4);
+(state $foo, state $bar) = (5, 6);
+(undef, my $v, state $w) = (7 .. 9);
+EXPECT
+State variable $z will be reinitialized at - line 6.
+State variable $foo will be reinitialized at - line 7.
+State variable $bar will be reinitialized at - line 7.
+State variable $w will be reinitialized at - line 8.