The warning "Possible precedence problem on bitwise operator"
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pad
CommitLineData
f21d7107 1 pad.c AOK
2
3 "my" variable %s masks earlier declaration in same scope
4 my $x;
5 my $x ;
6
b5c19bd7 7 Variable "%s" will not stay shared
f21d7107 8 sub x {
9 my $x;
10 sub y {
b5c19bd7 11 sub { $x }
f21d7107 12 }
13 }
14
f21d7107 15 sub x {
16 my $x;
17 sub y {
b5c19bd7 18 $x
f21d7107 19 }
20 }
b5c19bd7 21
f21d7107 22 "our" variable %s redeclared (Did you mean "local" instead of "our"?)
23 our $x;
24 {
25 our $x;
26 }
27
28 %s never introduced [pad_leavemy] TODO
29
30__END__
31# pad.c
32use warnings 'misc' ;
33my $x ;
34my $x ;
35my $y = my $y ;
36no warnings 'misc' ;
37my $x ;
38my $y ;
39EXPECT
40"my" variable $x masks earlier declaration in same scope at - line 4.
41"my" variable $y masks earlier declaration in same statement at - line 5.
42########
43# pad.c
44use warnings 'closure' ;
45sub x {
46 my $x;
47 sub y {
48 $x
49 }
50 }
51EXPECT
52Variable "$x" will not stay shared at - line 7.
53########
54# pad.c
55no warnings 'closure' ;
56sub x {
57 my $x;
58 sub y {
59 $x
60 }
61 }
62EXPECT
63
64########
65# pad.c
66use warnings 'closure' ;
67sub x {
b5c19bd7 68 my $x;
f21d7107 69 sub y {
b5c19bd7 70 sub { $x }
f21d7107 71 }
72 }
73EXPECT
b5c19bd7 74Variable "$x" will not stay shared at - line 6.
75########
76# pad.c
77use warnings 'closure' ;
78sub x {
79 my $x;
80 sub {
81 $x;
82 sub y {
83 $x
84 }
85 }->();
86}
87EXPECT
88Variable "$x" will not stay shared at - line 9.
89########
90# pad.c
91use warnings 'closure' ;
92my $x;
93sub {
94 $x;
95 sub f {
96 sub { $x }->();
97 }
98}->();
99EXPECT
f21d7107 100
101########
102# pad.c
103use warnings 'closure' ;
b5c19bd7 104sub {
105 my $x;
106 sub f { $x }
107}->();
108EXPECT
109Variable "$x" is not available at - line 5.
110########
111# pad.c
112use warnings 'closure' ;
113sub {
114 my $x;
115 eval 'sub f { $x }';
116}->();
117EXPECT
118
119########
120# pad.c
121use warnings 'closure' ;
122sub {
123 my $x;
124 sub f { eval '$x' }
125}->();
126f();
127EXPECT
128Variable "$x" is not available at (eval 1) line 2.
129########
130# pad.c
131use warnings 'closure' ;
f21d7107 132sub x {
b5c19bd7 133 our $x;
f21d7107 134 sub y {
b5c19bd7 135 $x
f21d7107 136 }
137 }
138EXPECT
b5c19bd7 139
140########
141# pad.c
142# see bugid 1754
143use warnings 'closure' ;
144sub f {
145 my $x;
146 sub { eval '$x' };
147}
148f()->();
149EXPECT
150Variable "$x" is not available at (eval 1) line 2.
f21d7107 151########
152# pad.c
153no warnings 'closure' ;
154sub x {
155 my $x;
156 sub y {
157 sub { $x }
158 }
159 }
160EXPECT
161
162########
163use warnings 'misc' ;
164our $x;
165{
166 our $x;
167}
168EXPECT
169"our" variable $x redeclared at - line 4.
170 (Did you mean "local" instead of "our"?)