Commit | Line | Data |
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 |
32 | use warnings 'misc' ; |
33 | my $x ; |
34 | my $x ; |
35 | my $y = my $y ; |
36 | no warnings 'misc' ; |
37 | my $x ; |
38 | my $y ; |
39 | EXPECT |
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 |
f793795c |
44 | use warnings 'misc' ; |
45 | our $x ; |
46 | our $x ; |
47 | our $y = our $y ; |
48 | no warnings 'misc' ; |
49 | our $x ; |
50 | our $y ; |
51 | EXPECT |
52 | "our" variable $x masks earlier declaration in same scope at - line 4. |
53 | "our" variable $y masks earlier declaration in same statement at - line 5. |
54 | ######## |
55 | # pad.c |
56 | use warnings 'misc' ; |
57 | our $x ; |
58 | my $x ; |
59 | our $y = my $y ; |
60 | no warnings 'misc' ; |
61 | our $z ; |
62 | my $z ; |
63 | our $t = my $t ; |
64 | EXPECT |
65 | "my" variable $x masks earlier declaration in same scope at - line 4. |
66 | "my" variable $y masks earlier declaration in same statement at - line 5. |
67 | ######## |
68 | # pad.c |
69 | # TODO not implemented yet |
70 | use warnings 'misc' ; |
71 | my $x ; |
72 | our $x ; |
73 | my $y = our $y ; |
74 | no warnings 'misc' ; |
75 | my $z ; |
76 | our $z ; |
77 | my $t = our $t ; |
78 | EXPECT |
79 | "our" variable $x masks earlier declaration in same scope at - line 5. |
80 | "our" variable $y masks earlier declaration in same statement at - line 6. |
81 | ######## |
82 | # pad.c |
f21d7107 |
83 | use warnings 'closure' ; |
84 | sub x { |
85 | my $x; |
86 | sub y { |
87 | $x |
88 | } |
89 | } |
90 | EXPECT |
91 | Variable "$x" will not stay shared at - line 7. |
92 | ######## |
93 | # pad.c |
94 | no warnings 'closure' ; |
95 | sub x { |
96 | my $x; |
97 | sub y { |
98 | $x |
99 | } |
100 | } |
101 | EXPECT |
102 | |
103 | ######## |
104 | # pad.c |
105 | use warnings 'closure' ; |
106 | sub x { |
b5c19bd7 |
107 | my $x; |
f21d7107 |
108 | sub y { |
b5c19bd7 |
109 | sub { $x } |
f21d7107 |
110 | } |
111 | } |
112 | EXPECT |
b5c19bd7 |
113 | Variable "$x" will not stay shared at - line 6. |
114 | ######## |
115 | # pad.c |
116 | use warnings 'closure' ; |
117 | sub x { |
118 | my $x; |
119 | sub { |
120 | $x; |
121 | sub y { |
122 | $x |
123 | } |
124 | }->(); |
125 | } |
126 | EXPECT |
127 | Variable "$x" will not stay shared at - line 9. |
128 | ######## |
129 | # pad.c |
130 | use warnings 'closure' ; |
131 | my $x; |
132 | sub { |
133 | $x; |
134 | sub f { |
135 | sub { $x }->(); |
136 | } |
137 | }->(); |
138 | EXPECT |
f21d7107 |
139 | |
140 | ######## |
141 | # pad.c |
142 | use warnings 'closure' ; |
b5c19bd7 |
143 | sub { |
144 | my $x; |
145 | sub f { $x } |
146 | }->(); |
147 | EXPECT |
148 | Variable "$x" is not available at - line 5. |
149 | ######## |
150 | # pad.c |
151 | use warnings 'closure' ; |
152 | sub { |
153 | my $x; |
154 | eval 'sub f { $x }'; |
155 | }->(); |
156 | EXPECT |
157 | |
158 | ######## |
159 | # pad.c |
160 | use warnings 'closure' ; |
161 | sub { |
162 | my $x; |
163 | sub f { eval '$x' } |
164 | }->(); |
165 | f(); |
166 | EXPECT |
167 | Variable "$x" is not available at (eval 1) line 2. |
168 | ######## |
169 | # pad.c |
170 | use warnings 'closure' ; |
f21d7107 |
171 | sub x { |
b5c19bd7 |
172 | our $x; |
f21d7107 |
173 | sub y { |
b5c19bd7 |
174 | $x |
f21d7107 |
175 | } |
176 | } |
177 | EXPECT |
b5c19bd7 |
178 | |
179 | ######## |
180 | # pad.c |
181 | # see bugid 1754 |
182 | use warnings 'closure' ; |
183 | sub f { |
184 | my $x; |
185 | sub { eval '$x' }; |
186 | } |
187 | f()->(); |
188 | EXPECT |
189 | Variable "$x" is not available at (eval 1) line 2. |
f21d7107 |
190 | ######## |
2740392c |
191 | use warnings 'closure' ; |
192 | { |
193 | my $x = 1; |
194 | $y = \$x; # force abandonment rather than clear-in-place at scope exit |
195 | sub f2 { eval '$x' } |
196 | } |
197 | f2(); |
198 | EXPECT |
199 | Variable "$x" is not available at (eval 1) line 2. |
200 | ######## |
14f338dc |
201 | use warnings 'closure' ; |
202 | for my $x (1,2,3) { |
203 | sub f { eval '$x' } |
204 | f(); |
205 | } |
206 | f(); |
207 | EXPECT |
208 | Variable "$x" is not available at (eval 4) line 2. |
209 | ######## |
f21d7107 |
210 | # pad.c |
211 | no warnings 'closure' ; |
212 | sub x { |
213 | my $x; |
214 | sub y { |
215 | sub { $x } |
216 | } |
217 | } |
218 | EXPECT |
219 | |
220 | ######## |
221 | use warnings 'misc' ; |
222 | our $x; |
223 | { |
224 | our $x; |
225 | } |
226 | EXPECT |
227 | "our" variable $x redeclared at - line 4. |
228 | (Did you mean "local" instead of "our"?) |
929a0744 |
229 | ######## |
230 | # an our var being introduced should suppress errors about global syms |
231 | use strict; |
232 | use warnings; |
233 | our $x unless $x; |
234 | EXPECT |