Commit | Line | Data |
---|---|---|
599cee73 PM |
1 | toke.c AOK |
2 | ||
3 | we seem to have lost a few ambiguous warnings!! | |
4 | ||
5 | ||
599cee73 PM |
6 | $a = <<; |
7 | Use of comma-less variable list is deprecated | |
8 | (called 3 times via depcom) | |
9 | ||
10 | \1 better written as $1 | |
4438c4b7 | 11 | use warnings 'syntax' ; |
599cee73 PM |
12 | s/(abc)/\1/; |
13 | ||
14 | warn(warn_nosemi) | |
15 | Semicolon seems to be missing | |
16 | $a = 1 | |
17 | &time ; | |
18 | ||
19 | ||
20 | Reversed %c= operator | |
21 | my $a =+ 2 ; | |
22 | $a =- 2 ; | |
23 | $a =* 2 ; | |
24 | $a =% 2 ; | |
25 | $a =& 2 ; | |
26 | $a =. 2 ; | |
27 | $a =^ 2 ; | |
28 | $a =| 2 ; | |
29 | $a =< 2 ; | |
30 | $a =/ 2 ; | |
31 | ||
32 | Multidimensional syntax %.*s not supported | |
33 | my $a = $a[1,2] ; | |
34 | ||
35 | You need to quote \"%s\"" | |
36 | sub fred {} ; $SIG{TERM} = fred; | |
37 | ||
38 | Scalar value %.*s better written as $%.*s" | |
39 | @a[3] = 2; | |
40 | @a{3} = 2; | |
41 | ||
42 | Can't use \\%c to mean $%c in expression | |
43 | $_ = "ab" ; s/(ab)/\1/e; | |
44 | ||
45 | Unquoted string "abc" may clash with future reserved word at - line 3. | |
46 | warn(warn_reserved | |
47 | $a = abc; | |
48 | ||
599cee73 PM |
49 | Possible attempt to separate words with commas |
50 | @a = qw(a, b, c) ; | |
51 | ||
52 | Possible attempt to put comments in qw() list | |
53 | @a = qw(a b # c) ; | |
54 | ||
599cee73 PM |
55 | %s (...) interpreted as function |
56 | print ("") | |
57 | printf ("") | |
58 | sort ("") | |
59 | ||
60 | Ambiguous use of %c{%s%s} resolved to %c%s%s | |
61 | $a = ${time[2]} | |
62 | $a = ${time{2}} | |
63 | ||
64 | ||
65 | Ambiguous use of %c{%s} resolved to %c%s | |
66 | $a = ${time} | |
67 | sub fred {} $a = ${fred} | |
68 | ||
69 | Misplaced _ in number | |
70 | $a = 1_2; | |
71 | $a = 1_2345_6; | |
72 | ||
73 | Bareword \"%s\" refers to nonexistent package | |
74 | $a = FRED:: ; | |
75 | ||
76 | Ambiguous call resolved as CORE::%s(), qualify as such or use & | |
77 | sub time {} | |
78 | my $a = time() | |
79 | ||
767a6a26 PM |
80 | Unrecognized escape \\%c passed through |
81 | $a = "\m" ; | |
82 | ||
83 | %s number > %s non-portable | |
84 | my $a = 0b011111111111111111111111111111110 ; | |
85 | $a = 0b011111111111111111111111111111111 ; | |
86 | $a = 0b111111111111111111111111111111111 ; | |
87 | $a = 0x0fffffffe ; | |
88 | $a = 0x0ffffffff ; | |
89 | $a = 0x1ffffffff ; | |
90 | $a = 0037777777776 ; | |
91 | $a = 0037777777777 ; | |
92 | $a = 0047777777777 ; | |
93 | ||
94 | Integer overflow in binary number | |
95 | my $a = 0b011111111111111111111111111111110 ; | |
96 | $a = 0b011111111111111111111111111111111 ; | |
97 | $a = 0b111111111111111111111111111111111 ; | |
98 | $a = 0x0fffffffe ; | |
99 | $a = 0x0ffffffff ; | |
100 | $a = 0x1ffffffff ; | |
101 | $a = 0037777777776 ; | |
102 | $a = 0037777777777 ; | |
103 | $a = 0047777777777 ; | |
ac206dc8 RGS |
104 | |
105 | dump() better written as CORE::dump() | |
4ac733c9 MJD |
106 | |
107 | Use of /c modifier is meaningless without /g | |
108 | ||
64e578a2 MJD |
109 | Use of /c modifier is meaningless in s/// |
110 | ||
0453d815 PM |
111 | Mandatory Warnings |
112 | ------------------ | |
113 | Use of "%s" without parentheses is ambiguous [check_uni] | |
114 | rand + 4 | |
115 | ||
116 | Ambiguous use of -%s resolved as -&%s() [yylex] | |
117 | sub fred {} ; - fred ; | |
118 | ||
119 | Precedence problem: open %.*s should be open(%.*s) [yylex] | |
120 | open FOO || die; | |
121 | ||
122 | Operator or semicolon missing before %c%s [yylex] | |
123 | Ambiguous use of %c resolved as operator %c | |
124 | *foo *foo | |
125 | ||
599cee73 PM |
126 | __END__ |
127 | # toke.c | |
599cee73 PM |
128 | format STDOUT = |
129 | @<<< @||| @>>> @>>> | |
130 | $a $b "abc" 'def' | |
131 | . | |
4438c4b7 | 132 | no warnings 'deprecated' ; |
0453d815 PM |
133 | format STDOUT = |
134 | @<<< @||| @>>> @>>> | |
135 | $a $b "abc" 'def' | |
136 | . | |
599cee73 | 137 | EXPECT |
d1d15184 NC |
138 | Use of comma-less variable list is deprecated at - line 4. |
139 | Use of comma-less variable list is deprecated at - line 4. | |
140 | Use of comma-less variable list is deprecated at - line 4. | |
599cee73 PM |
141 | ######## |
142 | # toke.c | |
e6897b1a | 143 | $a =~ m/$foo/sand $bar; |
aa78b661 | 144 | $a =~ s/$foo/fool/sand $bar; |
599cee73 PM |
145 | $a = <<; |
146 | ||
4438c4b7 | 147 | no warnings 'deprecated' ; |
e6897b1a | 148 | $a =~ m/$foo/sand $bar; |
aa78b661 | 149 | $a =~ s/$foo/fool/sand $bar; |
0453d815 PM |
150 | $a = <<; |
151 | ||
599cee73 | 152 | EXPECT |
e6897b1a | 153 | Having no space between pattern and following word is deprecated at - line 2. |
aa78b661 KW |
154 | Having no space between pattern and following word is deprecated at - line 3. |
155 | Use of bare << to mean <<"" is deprecated at - line 4. | |
599cee73 PM |
156 | ######## |
157 | # toke.c | |
4438c4b7 | 158 | use warnings 'syntax' ; |
599cee73 | 159 | s/(abc)/\1/; |
4438c4b7 | 160 | no warnings 'syntax' ; |
0453d815 | 161 | s/(abc)/\1/; |
599cee73 PM |
162 | EXPECT |
163 | \1 better written as $1 at - line 3. | |
164 | ######## | |
165 | # toke.c | |
4438c4b7 | 166 | use warnings 'semicolon' ; |
599cee73 PM |
167 | $a = 1 |
168 | &time ; | |
4438c4b7 | 169 | no warnings 'semicolon' ; |
0453d815 PM |
170 | $a = 1 |
171 | &time ; | |
599cee73 PM |
172 | EXPECT |
173 | Semicolon seems to be missing at - line 3. | |
174 | ######## | |
175 | # toke.c | |
4438c4b7 | 176 | use warnings 'syntax' ; |
599cee73 PM |
177 | my $a =+ 2 ; |
178 | $a =- 2 ; | |
179 | $a =* 2 ; | |
180 | $a =% 2 ; | |
181 | $a =& 2 ; | |
182 | $a =. 2 ; | |
183 | $a =^ 2 ; | |
184 | $a =| 2 ; | |
185 | $a =< 2 ; | |
186 | $a =/ 2 ; | |
187 | EXPECT | |
7f01dc7a JH |
188 | Reversed += operator at - line 3. |
189 | Reversed -= operator at - line 4. | |
190 | Reversed *= operator at - line 5. | |
191 | Reversed %= operator at - line 6. | |
192 | Reversed &= operator at - line 7. | |
193 | Reversed .= operator at - line 8. | |
194 | Reversed ^= operator at - line 9. | |
195 | Reversed |= operator at - line 10. | |
196 | Reversed <= operator at - line 11. | |
197 | syntax error at - line 8, near "=." | |
198 | syntax error at - line 9, near "=^" | |
199 | syntax error at - line 10, near "=|" | |
200 | Unterminated <> operator at - line 11. | |
599cee73 PM |
201 | ######## |
202 | # toke.c | |
4438c4b7 | 203 | no warnings 'syntax' ; |
0453d815 PM |
204 | my $a =+ 2 ; |
205 | $a =- 2 ; | |
206 | $a =* 2 ; | |
207 | $a =% 2 ; | |
208 | $a =& 2 ; | |
209 | $a =. 2 ; | |
210 | $a =^ 2 ; | |
211 | $a =| 2 ; | |
212 | $a =< 2 ; | |
213 | $a =/ 2 ; | |
214 | EXPECT | |
7f01dc7a JH |
215 | syntax error at - line 8, near "=." |
216 | syntax error at - line 9, near "=^" | |
217 | syntax error at - line 10, near "=|" | |
218 | Unterminated <> operator at - line 11. | |
0453d815 PM |
219 | ######## |
220 | # toke.c | |
4438c4b7 | 221 | use warnings 'syntax' ; |
599cee73 | 222 | my $a = $a[1,2] ; |
4438c4b7 | 223 | no warnings 'syntax' ; |
0453d815 | 224 | my $a = $a[1,2] ; |
599cee73 PM |
225 | EXPECT |
226 | Multidimensional syntax $a[1,2] not supported at - line 3. | |
227 | ######## | |
228 | # toke.c | |
4438c4b7 | 229 | use warnings 'syntax' ; |
599cee73 | 230 | sub fred {} ; $SIG{TERM} = fred; |
4438c4b7 | 231 | no warnings 'syntax' ; |
0453d815 | 232 | $SIG{TERM} = fred; |
599cee73 PM |
233 | EXPECT |
234 | You need to quote "fred" at - line 3. | |
235 | ######## | |
236 | # toke.c | |
4438c4b7 | 237 | use warnings 'syntax' ; |
599cee73 PM |
238 | @a[3] = 2; |
239 | @a{3} = 2; | |
4438c4b7 | 240 | no warnings 'syntax' ; |
0453d815 PM |
241 | @a[3] = 2; |
242 | @a{3} = 2; | |
599cee73 PM |
243 | EXPECT |
244 | Scalar value @a[3] better written as $a[3] at - line 3. | |
245 | Scalar value @a{3} better written as $a{3} at - line 4. | |
246 | ######## | |
247 | # toke.c | |
4438c4b7 | 248 | use warnings 'syntax' ; |
599cee73 PM |
249 | $_ = "ab" ; |
250 | s/(ab)/\1/e; | |
4438c4b7 | 251 | no warnings 'syntax' ; |
0453d815 PM |
252 | $_ = "ab" ; |
253 | s/(ab)/\1/e; | |
599cee73 PM |
254 | EXPECT |
255 | Can't use \1 to mean $1 in expression at - line 4. | |
256 | ######## | |
257 | # toke.c | |
4438c4b7 | 258 | use warnings 'reserved' ; |
599cee73 | 259 | $a = abc; |
1c3923b3 GS |
260 | $a = { def |
261 | ||
262 | => 1 }; | |
4438c4b7 | 263 | no warnings 'reserved' ; |
0453d815 | 264 | $a = abc; |
599cee73 PM |
265 | EXPECT |
266 | Unquoted string "abc" may clash with future reserved word at - line 3. | |
267 | ######## | |
268 | # toke.c | |
e476b1b5 | 269 | use warnings 'qw' ; |
599cee73 | 270 | @a = qw(a, b, c) ; |
e476b1b5 | 271 | no warnings 'qw' ; |
0453d815 | 272 | @a = qw(a, b, c) ; |
599cee73 PM |
273 | EXPECT |
274 | Possible attempt to separate words with commas at - line 3. | |
275 | ######## | |
276 | # toke.c | |
e476b1b5 | 277 | use warnings 'qw' ; |
7e03b518 | 278 | @a = qw(a b c # #) ; |
e476b1b5 | 279 | no warnings 'qw' ; |
7e03b518 | 280 | @a = qw(a b c # #) ; |
599cee73 PM |
281 | EXPECT |
282 | Possible attempt to put comments in qw() list at - line 3. | |
283 | ######## | |
284 | # toke.c | |
7e03b518 EB |
285 | use warnings 'qw' ; |
286 | @a = qw(a, b, c # #) ; | |
287 | no warnings 'qw' ; | |
288 | @a = qw(a, b, c # #) ; | |
289 | EXPECT | |
290 | Possible attempt to separate words with commas at - line 3. | |
291 | Possible attempt to put comments in qw() list at - line 3. | |
292 | ######## | |
293 | # toke.c | |
4438c4b7 | 294 | use warnings 'syntax' ; |
b1439985 RGS |
295 | print (""); |
296 | print ("") and $x = 1; | |
297 | print ("") or die; | |
298 | print ("") // die; | |
299 | print (1+2) * 3 if 0; # only this one should warn | |
300 | print (1+2) if 0; | |
599cee73 | 301 | EXPECT |
b1439985 | 302 | print (...) interpreted as function at - line 7. |
599cee73 PM |
303 | ######## |
304 | # toke.c | |
4438c4b7 | 305 | no warnings 'syntax' ; |
0453d815 PM |
306 | print ("") |
307 | EXPECT | |
308 | ||
309 | ######## | |
310 | # toke.c | |
4438c4b7 | 311 | use warnings 'syntax' ; |
b1439985 RGS |
312 | printf (""); |
313 | printf ("") . ''; | |
599cee73 | 314 | EXPECT |
b1439985 | 315 | printf (...) interpreted as function at - line 4. |
599cee73 PM |
316 | ######## |
317 | # toke.c | |
4438c4b7 | 318 | no warnings 'syntax' ; |
0453d815 PM |
319 | printf ("") |
320 | EXPECT | |
321 | ||
322 | ######## | |
323 | # toke.c | |
4438c4b7 | 324 | use warnings 'syntax' ; |
b1439985 RGS |
325 | sort (""); |
326 | sort ("") . ''; | |
599cee73 | 327 | EXPECT |
b1439985 | 328 | sort (...) interpreted as function at - line 4. |
599cee73 PM |
329 | ######## |
330 | # toke.c | |
4438c4b7 | 331 | no warnings 'syntax' ; |
0453d815 PM |
332 | sort ("") |
333 | EXPECT | |
334 | ||
335 | ######## | |
336 | # toke.c | |
4438c4b7 | 337 | use warnings 'ambiguous' ; |
599cee73 | 338 | $a = ${time[2]}; |
4438c4b7 | 339 | no warnings 'ambiguous' ; |
0453d815 | 340 | $a = ${time[2]}; |
599cee73 PM |
341 | EXPECT |
342 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. | |
343 | ######## | |
344 | # toke.c | |
4438c4b7 | 345 | use warnings 'ambiguous' ; |
599cee73 PM |
346 | $a = ${time{2}}; |
347 | EXPECT | |
348 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. | |
349 | ######## | |
350 | # toke.c | |
4438c4b7 | 351 | no warnings 'ambiguous' ; |
0453d815 PM |
352 | $a = ${time{2}}; |
353 | EXPECT | |
354 | ||
355 | ######## | |
356 | # toke.c | |
4438c4b7 | 357 | use warnings 'ambiguous' ; |
599cee73 | 358 | $a = ${time} ; |
4438c4b7 | 359 | no warnings 'ambiguous' ; |
0453d815 | 360 | $a = ${time} ; |
599cee73 PM |
361 | EXPECT |
362 | Ambiguous use of ${time} resolved to $time at - line 3. | |
363 | ######## | |
364 | # toke.c | |
4438c4b7 | 365 | use warnings 'ambiguous' ; |
599cee73 PM |
366 | sub fred {} |
367 | $a = ${fred} ; | |
4438c4b7 | 368 | no warnings 'ambiguous' ; |
0453d815 | 369 | $a = ${fred} ; |
599cee73 PM |
370 | EXPECT |
371 | Ambiguous use of ${fred} resolved to $fred at - line 4. | |
372 | ######## | |
373 | # toke.c | |
4438c4b7 | 374 | use warnings 'syntax' ; |
7fd134d9 JH |
375 | $a = _123; print "$a\n"; #( 3 string) |
376 | $a = 1_23; print "$a\n"; | |
377 | $a = 12_3; print "$a\n"; | |
378 | $a = 123_; print "$a\n"; # 6 | |
379 | $a = _+123; print "$a\n"; # 7 string) | |
380 | $a = +_123; print "$a\n"; #( 8 string) | |
381 | $a = +1_23; print "$a\n"; | |
382 | $a = +12_3; print "$a\n"; | |
383 | $a = +123_; print "$a\n"; # 11 | |
384 | $a = _-123; print "$a\n"; #(12 string) | |
385 | $a = -_123; print "$a\n"; #(13 string) | |
386 | $a = -1_23; print "$a\n"; | |
387 | $a = -12_3; print "$a\n"; | |
388 | $a = -123_; print "$a\n"; # 16 | |
389 | $a = 123._456; print "$a\n"; # 17 | |
390 | $a = 123.4_56; print "$a\n"; | |
391 | $a = 123.45_6; print "$a\n"; | |
392 | $a = 123.456_; print "$a\n"; # 20 | |
393 | $a = +123._456; print "$a\n"; # 21 | |
394 | $a = +123.4_56; print "$a\n"; | |
395 | $a = +123.45_6; print "$a\n"; | |
396 | $a = +123.456_; print "$a\n"; # 24 | |
397 | $a = -123._456; print "$a\n"; # 25 | |
398 | $a = -123.4_56; print "$a\n"; | |
399 | $a = -123.45_6; print "$a\n"; | |
400 | $a = -123.456_; print "$a\n"; # 28 | |
2bea9a37 JH |
401 | $a = 123.456E_12; printf("%.0f\n", $a); # 29 |
402 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
403 | $a = 123.456E12_; printf("%.0f\n", $a); # 31 | |
404 | $a = 123.456E_+12; printf("%.0f\n", $a); # 32 | |
405 | $a = 123.456E+_12; printf("%.0f\n", $a); # 33 | |
406 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
407 | $a = 123.456E+12_; printf("%.0f\n", $a); # 35 | |
7fd134d9 JH |
408 | $a = 123.456E_-12; print "$a\n"; # 36 |
409 | $a = 123.456E-_12; print "$a\n"; # 37 | |
410 | $a = 123.456E-1_2; print "$a\n"; | |
411 | $a = 123.456E-12_; print "$a\n"; # 39 | |
b3b48e3e JH |
412 | $a = 1__23; print "$a\n"; # 40 |
413 | $a = 12.3__4; print "$a\n"; # 41 | |
2bea9a37 | 414 | $a = 12.34e1__2; printf("%.0f\n", $a); # 42 |
4438c4b7 | 415 | no warnings 'syntax' ; |
7fd134d9 JH |
416 | $a = _123; print "$a\n"; |
417 | $a = 1_23; print "$a\n"; | |
418 | $a = 12_3; print "$a\n"; | |
419 | $a = 123_; print "$a\n"; | |
420 | $a = _+123; print "$a\n"; | |
421 | $a = +_123; print "$a\n"; | |
422 | $a = +1_23; print "$a\n"; | |
423 | $a = +12_3; print "$a\n"; | |
424 | $a = +123_; print "$a\n"; | |
425 | $a = _-123; print "$a\n"; | |
426 | $a = -_123; print "$a\n"; | |
427 | $a = -1_23; print "$a\n"; | |
428 | $a = -12_3; print "$a\n"; | |
429 | $a = -123_; print "$a\n"; | |
430 | $a = 123._456; print "$a\n"; | |
431 | $a = 123.4_56; print "$a\n"; | |
432 | $a = 123.45_6; print "$a\n"; | |
433 | $a = 123.456_; print "$a\n"; | |
434 | $a = +123._456; print "$a\n"; | |
435 | $a = +123.4_56; print "$a\n"; | |
436 | $a = +123.45_6; print "$a\n"; | |
437 | $a = +123.456_; print "$a\n"; | |
438 | $a = -123._456; print "$a\n"; | |
439 | $a = -123.4_56; print "$a\n"; | |
440 | $a = -123.45_6; print "$a\n"; | |
441 | $a = -123.456_; print "$a\n"; | |
2bea9a37 JH |
442 | $a = 123.456E_12; printf("%.0f\n", $a); |
443 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
444 | $a = 123.456E12_; printf("%.0f\n", $a); | |
445 | $a = 123.456E_+12; printf("%.0f\n", $a); | |
446 | $a = 123.456E+_12; printf("%.0f\n", $a); | |
447 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
448 | $a = 123.456E+12_; printf("%.0f\n", $a); | |
7fd134d9 JH |
449 | $a = 123.456E_-12; print "$a\n"; |
450 | $a = 123.456E-_12; print "$a\n"; | |
451 | $a = 123.456E-1_2; print "$a\n"; | |
452 | $a = 123.456E-12_; print "$a\n"; | |
b3b48e3e JH |
453 | $a = 1__23; print "$a\n"; |
454 | $a = 12.3__4; print "$a\n"; | |
2bea9a37 | 455 | $a = 12.34e1__2; printf("%.0f\n", $a); |
599cee73 | 456 | EXPECT |
fbfa96bd | 457 | OPTIONS regex |
928753ea | 458 | Misplaced _ in number at - line 6. |
928753ea | 459 | Misplaced _ in number at - line 11. |
7fd134d9 | 460 | Misplaced _ in number at - line 16. |
928753ea | 461 | Misplaced _ in number at - line 17. |
7fd134d9 | 462 | Misplaced _ in number at - line 20. |
928753ea | 463 | Misplaced _ in number at - line 21. |
7fd134d9 JH |
464 | Misplaced _ in number at - line 24. |
465 | Misplaced _ in number at - line 25. | |
466 | Misplaced _ in number at - line 28. | |
467 | Misplaced _ in number at - line 29. | |
468 | Misplaced _ in number at - line 31. | |
469 | Misplaced _ in number at - line 32. | |
470 | Misplaced _ in number at - line 33. | |
471 | Misplaced _ in number at - line 35. | |
472 | Misplaced _ in number at - line 36. | |
473 | Misplaced _ in number at - line 37. | |
474 | Misplaced _ in number at - line 39. | |
b3b48e3e JH |
475 | Misplaced _ in number at - line 40. |
476 | Misplaced _ in number at - line 41. | |
477 | Misplaced _ in number at - line 42. | |
928753ea JH |
478 | _123 |
479 | 123 | |
928753ea | 480 | 123 |
7fd134d9 JH |
481 | 123 |
482 | 123 | |
483 | _123 | |
484 | 123 | |
485 | 123 | |
486 | 123 | |
487 | -123 | |
488 | -_123 | |
489 | -123 | |
490 | -123 | |
491 | -123 | |
492 | 123.456 | |
493 | 123.456 | |
494 | 123.456 | |
495 | 123.456 | |
496 | 123.456 | |
497 | 123.456 | |
498 | 123.456 | |
499 | 123.456 | |
500 | -123.456 | |
501 | -123.456 | |
502 | -123.456 | |
503 | -123.456 | |
504 | 123456000000000 | |
505 | 123456000000000 | |
506 | 123456000000000 | |
507 | 123456000000000 | |
508 | 123456000000000 | |
509 | 123456000000000 | |
510 | 123456000000000 | |
fbfa96bd NIS |
511 | 1.23456e-0?10 |
512 | 1.23456e-0?10 | |
513 | 1.23456e-0?10 | |
514 | 1.23456e-0?10 | |
b3b48e3e JH |
515 | 123 |
516 | 12.34 | |
517 | 12340000000000 | |
7fd134d9 JH |
518 | _123 |
519 | 123 | |
520 | 123 | |
521 | 123 | |
522 | 123 | |
523 | _123 | |
524 | 123 | |
525 | 123 | |
526 | 123 | |
527 | -123 | |
528 | -_123 | |
529 | -123 | |
530 | -123 | |
531 | -123 | |
532 | 123.456 | |
533 | 123.456 | |
534 | 123.456 | |
535 | 123.456 | |
536 | 123.456 | |
928753ea JH |
537 | 123.456 |
538 | 123.456 | |
928753ea | 539 | 123.456 |
7fd134d9 JH |
540 | -123.456 |
541 | -123.456 | |
542 | -123.456 | |
543 | -123.456 | |
544 | 123456000000000 | |
545 | 123456000000000 | |
546 | 123456000000000 | |
547 | 123456000000000 | |
548 | 123456000000000 | |
549 | 123456000000000 | |
550 | 123456000000000 | |
fbfa96bd NIS |
551 | 1.23456e-0?10 |
552 | 1.23456e-0?10 | |
553 | 1.23456e-0?10 | |
554 | 1.23456e-0?10 | |
b3b48e3e JH |
555 | 123 |
556 | 12.34 | |
557 | 12340000000000 | |
599cee73 PM |
558 | ######## |
559 | # toke.c | |
e476b1b5 | 560 | use warnings 'bareword' ; |
60e6418e | 561 | #line 25 "bar" |
599cee73 | 562 | $a = FRED:: ; |
e476b1b5 | 563 | no warnings 'bareword' ; |
0453d815 PM |
564 | #line 25 "bar" |
565 | $a = FRED:: ; | |
599cee73 | 566 | EXPECT |
60e6418e | 567 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
599cee73 PM |
568 | ######## |
569 | # toke.c | |
4438c4b7 | 570 | use warnings 'ambiguous' ; |
599cee73 | 571 | sub time {} |
0453d815 | 572 | my $a = time() ; |
4438c4b7 | 573 | no warnings 'ambiguous' ; |
0453d815 | 574 | my $b = time() ; |
599cee73 PM |
575 | EXPECT |
576 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. | |
577 | ######## | |
578 | # toke.c | |
26d16222 | 579 | use warnings ; |
0453d815 | 580 | eval <<'EOE'; |
df0deb90 GS |
581 | # line 30 "foo" |
582 | warn "yelp"; | |
0453d815 | 583 | { |
0453d815 PM |
584 | $_ = " \x{123} " ; |
585 | } | |
586 | EOE | |
587 | EXPECT | |
df0deb90 | 588 | yelp at foo line 30. |
0453d815 PM |
589 | ######## |
590 | # toke.c | |
0453d815 PM |
591 | my $a = rand + 4 ; |
592 | EXPECT | |
2d5ccbba | 593 | Warning: Use of "rand" without parentheses is ambiguous at - line 2. |
0453d815 PM |
594 | ######## |
595 | # toke.c | |
596 | $^W = 0 ; | |
597 | my $a = rand + 4 ; | |
598 | { | |
4438c4b7 | 599 | no warnings 'ambiguous' ; |
0453d815 | 600 | $a = rand + 4 ; |
4438c4b7 | 601 | use warnings 'ambiguous' ; |
0453d815 PM |
602 | $a = rand + 4 ; |
603 | } | |
604 | $a = rand + 4 ; | |
605 | EXPECT | |
2d5ccbba IT |
606 | Warning: Use of "rand" without parentheses is ambiguous at - line 3. |
607 | Warning: Use of "rand" without parentheses is ambiguous at - line 8. | |
608 | Warning: Use of "rand" without parentheses is ambiguous at - line 10. | |
0453d815 | 609 | ######## |
e19a021b FC |
610 | # [perl #97110] |
611 | sub myrand(;$) { } | |
b5fb7ce3 | 612 | sub whatever($) { } |
e19a021b | 613 | my $a = myrand + 4 ; |
b5fb7ce3 | 614 | my $b = whatever + 4 ; |
e19a021b | 615 | EXPECT |
b5fb7ce3 | 616 | Warning: Use of "myrand" without parentheses is ambiguous at - line 4. |
e19a021b | 617 | ######## |
0453d815 | 618 | # toke.c |
e8ae98db RGS |
619 | use warnings "ambiguous"; |
620 | print for keys %+; # should not warn | |
621 | EXPECT | |
622 | ######## | |
623 | # toke.c | |
0453d815 PM |
624 | sub fred {}; |
625 | -fred ; | |
626 | EXPECT | |
627 | Ambiguous use of -fred resolved as -&fred() at - line 3. | |
628 | ######## | |
629 | # toke.c | |
630 | $^W = 0 ; | |
631 | sub fred {} ; | |
632 | -fred ; | |
633 | { | |
4438c4b7 | 634 | no warnings 'ambiguous' ; |
0453d815 | 635 | -fred ; |
4438c4b7 | 636 | use warnings 'ambiguous' ; |
0453d815 PM |
637 | -fred ; |
638 | } | |
639 | -fred ; | |
640 | EXPECT | |
641 | Ambiguous use of -fred resolved as -&fred() at - line 4. | |
642 | Ambiguous use of -fred resolved as -&fred() at - line 9. | |
643 | Ambiguous use of -fred resolved as -&fred() at - line 11. | |
644 | ######## | |
645 | # toke.c | |
646 | open FOO || time; | |
240d1b6f | 647 | open local *FOO; # should be ok |
0453d815 PM |
648 | EXPECT |
649 | Precedence problem: open FOO should be open(FOO) at - line 2. | |
650 | ######## | |
66fbe8fb HS |
651 | # toke.c (and [perl #16184]) |
652 | open FOO => "<&0"; close FOO; | |
653 | EXPECT | |
654 | ######## | |
0453d815 PM |
655 | # toke.c |
656 | $^W = 0 ; | |
657 | open FOO || time; | |
658 | { | |
e476b1b5 | 659 | no warnings 'precedence' ; |
0453d815 | 660 | open FOO || time; |
e476b1b5 | 661 | use warnings 'precedence' ; |
0453d815 PM |
662 | open FOO || time; |
663 | } | |
664 | open FOO || time; | |
db3abe52 | 665 | open Foo::BAR; # this should not warn |
0453d815 PM |
666 | EXPECT |
667 | Precedence problem: open FOO should be open(FOO) at - line 3. | |
668 | Precedence problem: open FOO should be open(FOO) at - line 8. | |
669 | Precedence problem: open FOO should be open(FOO) at - line 10. | |
670 | ######## | |
671 | # toke.c | |
672 | $^W = 0 ; | |
673 | *foo *foo ; | |
674 | { | |
4438c4b7 | 675 | no warnings 'ambiguous' ; |
0453d815 | 676 | *foo *foo ; |
4438c4b7 | 677 | use warnings 'ambiguous' ; |
0453d815 PM |
678 | *foo *foo ; |
679 | } | |
680 | *foo *foo ; | |
681 | EXPECT | |
682 | Operator or semicolon missing before *foo at - line 3. | |
683 | Ambiguous use of * resolved as operator * at - line 3. | |
684 | Operator or semicolon missing before *foo at - line 8. | |
685 | Ambiguous use of * resolved as operator * at - line 8. | |
686 | Operator or semicolon missing before *foo at - line 10. | |
687 | Ambiguous use of * resolved as operator * at - line 10. | |
767a6a26 PM |
688 | ######## |
689 | # toke.c | |
e476b1b5 | 690 | use warnings 'misc' ; |
767a6a26 | 691 | my $a = "\m" ; |
e476b1b5 | 692 | no warnings 'misc' ; |
767a6a26 PM |
693 | $a = "\m" ; |
694 | EXPECT | |
695 | Unrecognized escape \m passed through at - line 3. | |
696 | ######## | |
697 | # toke.c | |
698 | use warnings 'portable' ; | |
699 | my $a = 0b011111111111111111111111111111110 ; | |
700 | $a = 0b011111111111111111111111111111111 ; | |
701 | $a = 0b111111111111111111111111111111111 ; | |
702 | $a = 0x0fffffffe ; | |
703 | $a = 0x0ffffffff ; | |
704 | $a = 0x1ffffffff ; | |
705 | $a = 0037777777776 ; | |
706 | $a = 0037777777777 ; | |
707 | $a = 0047777777777 ; | |
708 | no warnings 'portable' ; | |
709 | $a = 0b011111111111111111111111111111110 ; | |
710 | $a = 0b011111111111111111111111111111111 ; | |
711 | $a = 0b111111111111111111111111111111111 ; | |
712 | $a = 0x0fffffffe ; | |
713 | $a = 0x0ffffffff ; | |
714 | $a = 0x1ffffffff ; | |
715 | $a = 0037777777776 ; | |
716 | $a = 0037777777777 ; | |
717 | $a = 0047777777777 ; | |
718 | EXPECT | |
719 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. | |
720 | Hexadecimal number > 0xffffffff non-portable at - line 8. | |
721 | Octal number > 037777777777 non-portable at - line 11. | |
722 | ######## | |
723 | # toke.c | |
724 | use warnings 'overflow' ; | |
725 | my $a = 0b011111111111111111111111111111110 ; | |
726 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 727 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
728 | $a = 0x0fffffffe ; |
729 | $a = 0x0ffffffff ; | |
15041a67 | 730 | $a = 0x10000000000000000 ; |
767a6a26 PM |
731 | $a = 0037777777776 ; |
732 | $a = 0037777777777 ; | |
15041a67 | 733 | $a = 002000000000000000000000; |
767a6a26 PM |
734 | no warnings 'overflow' ; |
735 | $a = 0b011111111111111111111111111111110 ; | |
736 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 737 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
738 | $a = 0x0fffffffe ; |
739 | $a = 0x0ffffffff ; | |
15041a67 | 740 | $a = 0x10000000000000000 ; |
767a6a26 PM |
741 | $a = 0037777777776 ; |
742 | $a = 0037777777777 ; | |
15041a67 | 743 | $a = 002000000000000000000000; |
767a6a26 PM |
744 | EXPECT |
745 | Integer overflow in binary number at - line 5. | |
746 | Integer overflow in hexadecimal number at - line 8. | |
747 | Integer overflow in octal number at - line 11. | |
8593bda5 GS |
748 | ######## |
749 | # toke.c | |
ac206dc8 RGS |
750 | BEGIN { $^C = 1; } |
751 | use warnings 'misc'; | |
752 | dump; | |
753 | CORE::dump; | |
754 | EXPECT | |
755 | dump() better written as CORE::dump() at - line 4. | |
756 | - syntax OK | |
757 | ######## | |
758 | # toke.c | |
759 | use warnings 'misc'; | |
760 | use subs qw/dump/; | |
93f09d7b | 761 | sub dump { print "no warning for overridden dump\n"; } |
ac206dc8 RGS |
762 | dump; |
763 | EXPECT | |
93f09d7b | 764 | no warning for overridden dump |
ac206dc8 RGS |
765 | ######## |
766 | # toke.c | |
8593bda5 GS |
767 | use warnings 'ambiguous'; |
768 | "@mjd_previously_unused_array"; | |
769 | no warnings 'ambiguous'; | |
770 | "@mjd_previously_unused_array"; | |
771 | EXPECT | |
772 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. | |
707afd92 MS |
773 | ######## |
774 | # toke.c | |
d8c55666 | 775 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
776 | use warnings 'regexp'; |
777 | "foo" =~ /foo/c; | |
64e578a2 | 778 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
779 | no warnings 'regexp'; |
780 | "foo" =~ /foo/c; | |
64e578a2 | 781 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
782 | EXPECT |
783 | Use of /c modifier is meaningless without /g at - line 4. | |
784 | ######## | |
785 | # toke.c | |
d8c55666 | 786 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
787 | use warnings 'regexp'; |
788 | $_ = "ab" ; | |
789 | s/ab/ab/c; | |
64e578a2 | 790 | s/ab/ab/cg; |
4ac733c9 MJD |
791 | no warnings 'regexp'; |
792 | s/ab/ab/c; | |
64e578a2 | 793 | s/ab/ab/cg; |
4ac733c9 | 794 | EXPECT |
64e578a2 MJD |
795 | Use of /c modifier is meaningless in s/// at - line 5. |
796 | Use of /c modifier is meaningless in s/// at - line 6. | |
d8c55666 MJD |
797 | ######## |
798 | -wa | |
799 | # toke.c | |
800 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
801 | print "@F\n"; | |
802 | EXPECT | |
803 | ||
804 | ######## | |
805 | -w | |
806 | # toke.c | |
807 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
808 | print "@F\n"; | |
809 | EXPECT | |
810 | Possible unintended interpolation of @F in string at - line 4. | |
811 | Name "main::F" used only once: possible typo at - line 4. | |
812 | ######## | |
813 | -wa | |
814 | # toke.c | |
815 | # 20020414 mjd-perl-patch+@plover.com | |
816 | EXPECT | |
817 | ||
2710853f MJD |
818 | ######## |
819 | # toke.c | |
820 | # 20020414 mjd-perl-patch+@plover.com | |
821 | # In 5.7.3, this emitted "Possible unintended interpolation" warnings | |
822 | use warnings 'ambiguous'; | |
823 | $s = "(@-)(@+)"; | |
824 | EXPECT | |
825 | ||
56da5a46 RGS |
826 | ######## |
827 | # toke.c | |
828 | # mandatory warning | |
829 | eval q/if ($a) { } elseif ($b) { }/; | |
830 | no warnings "syntax"; | |
831 | eval q/if ($a) { } elseif ($b) { }/; | |
832 | EXPECT | |
833 | elseif should be elsif at (eval 1) line 1. | |
834 | ######## | |
835 | # toke.c | |
836 | # mandatory warning | |
837 | eval q/5 6/; | |
838 | no warnings "syntax"; | |
839 | eval q/5 6/; | |
840 | EXPECT | |
841 | Number found where operator expected at (eval 1) line 1, near "5 6" | |
842 | (Missing operator before 6?) | |
984200d0 YST |
843 | ######## |
844 | # toke.c | |
845 | use warnings "syntax"; | |
846 | $_ = $a = 1; | |
847 | $a !=~ /1/; | |
848 | $a !=~ m#1#; | |
849 | $a !=~/1/; | |
850 | $a !=~ ?/?; | |
decca21c YST |
851 | $a !=~ y/1//; |
852 | $a !=~ tr/1//; | |
853 | $a !=~ s/1//; | |
984200d0 YST |
854 | $a != ~/1/; |
855 | no warnings "syntax"; | |
856 | $a !=~ /1/; | |
857 | $a !=~ m#1#; | |
858 | $a !=~/1/; | |
859 | $a !=~ ?/?; | |
decca21c YST |
860 | $a !=~ y/1//; |
861 | $a !=~ tr/1//; | |
862 | $a !=~ s/1//; | |
984200d0 YST |
863 | EXPECT |
864 | !=~ should be !~ at - line 4. | |
865 | !=~ should be !~ at - line 5. | |
866 | !=~ should be !~ at - line 6. | |
867 | !=~ should be !~ at - line 7. | |
decca21c YST |
868 | !=~ should be !~ at - line 8. |
869 | !=~ should be !~ at - line 9. | |
870 | !=~ should be !~ at - line 10. | |
1108974d RGS |
871 | ######## |
872 | # toke.c | |
873 | our $foo :unique; | |
8e5dadda NC |
874 | sub pam :locked; |
875 | sub glipp :locked { | |
876 | } | |
877 | sub whack_eth ($) : locked { | |
878 | } | |
d1d15184 | 879 | no warnings 'deprecated'; |
1108974d | 880 | our $bar :unique; |
8e5dadda NC |
881 | sub zapeth :locked; |
882 | sub ker_plop :locked { | |
883 | } | |
884 | sub swa_a_p ($) : locked { | |
885 | } | |
1108974d | 886 | EXPECT |
d1d15184 NC |
887 | Use of :unique is deprecated at - line 2. |
888 | Use of :locked is deprecated at - line 3. | |
889 | Use of :locked is deprecated at - line 4. | |
890 | Use of :locked is deprecated at - line 6. | |
9e8d7757 RB |
891 | ######## |
892 | # toke.c | |
893 | use warnings "syntax"; | |
894 | sub proto_after_array(@$); | |
895 | sub proto_after_arref(\@$); | |
896 | sub proto_after_arref2(\[@$]); | |
897 | sub proto_after_arref3(\[@$]_); | |
898 | sub proto_after_hash(%$); | |
899 | sub proto_after_hashref(\%$); | |
900 | sub proto_after_hashref2(\[%$]); | |
901 | sub underscore_last_pos($_); | |
902 | sub underscore2($_;$); | |
903 | sub underscore_fail($_$); | |
904 | sub underscore_after_at(@_); | |
905 | no warnings "syntax"; | |
906 | sub proto_after_array(@$); | |
907 | sub proto_after_hash(%$); | |
908 | sub underscore_fail($_$); | |
909 | EXPECT | |
910 | Prototype after '@' for main::proto_after_array : @$ at - line 3. | |
911 | Prototype after '%' for main::proto_after_hash : %$ at - line 7. | |
aef2a98a | 912 | Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12. |
9e8d7757 | 913 | Prototype after '@' for main::underscore_after_at : @_ at - line 13. |
77772344 B |
914 | ######## |
915 | # toke.c | |
916 | use warnings "ambiguous"; | |
917 | "foo\nn" =~ /^foo$\n/; | |
918 | "foo\nn" =~ /^foo${\}n/; | |
919 | my $foo = qr/^foo$\n/; | |
920 | my $bar = qr/^foo${\}n/; | |
921 | no warnings "ambiguous"; | |
922 | "foo\nn" =~ /^foo$\n/; | |
923 | "foo\nn" =~ /^foo${\}n/; | |
924 | my $foo = qr/^foo$\n/; | |
925 | my $bar = qr/^foo${\}n/; | |
926 | EXPECT | |
927 | Possible unintended interpolation of $\ in regex at - line 3. | |
928 | Possible unintended interpolation of $\ in regex at - line 5. | |
d83f38d8 NC |
929 | ######## |
930 | # toke.c | |
f0a2b745 KW |
931 | use warnings 'syntax' ; |
932 | my $a = "\o"; | |
933 | my $a = "\o{"; | |
934 | my $a = "\o{}"; | |
935 | no warnings 'syntax' ; | |
936 | my $a = "\o"; | |
937 | my $a = "\o{"; | |
938 | my $a = "\o{}"; | |
939 | EXPECT | |
940 | Missing braces on \o{} at - line 3, within string | |
941 | Missing right brace on \o{ at - line 4, within string | |
942 | Number with no digits at - line 5, within string | |
943 | BEGIN not safe after errors--compilation aborted at - line 6. | |
944 | ######## | |
945 | # toke.c | |
946 | use warnings 'digit' ; | |
947 | my $a = "\o{1238456}"; | |
948 | no warnings 'digit' ; | |
949 | my $a = "\o{1238456}"; | |
950 | EXPECT | |
951 | Non-octal character '8'. Resolved as "\o{123}" at - line 3. | |
725a61d7 Z |
952 | ######## |
953 | # toke.c | |
954 | use warnings; | |
955 | my $a = "foo"; | |
956 | print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2; | |
957 | EXPECT | |
958 | Use of ?PATTERN? without explicit operator is deprecated at - line 4. | |
959 | yes | |
960 | no | |
961 | no | |
17a3df4c KW |
962 | ######## |
963 | # toke.c | |
964 | use warnings; | |
965 | my $a = "\c{ack}"; | |
966 | $a = "\c,"; | |
967 | $a = "\c`"; | |
968 | no warnings 'syntax'; | |
969 | $a = "\c{ack}"; | |
970 | $a = "\c,"; | |
971 | $a = "\c`"; | |
972 | no warnings 'deprecated'; | |
973 | EXPECT | |
974 | "\c{" is deprecated and is more clearly written as ";" at - line 3. | |
975 | "\c," is more clearly written simply as "l" at - line 4. | |
976 | "\c`" is more clearly written simply as "\ " at - line 5. | |
977 | "\c{" is deprecated and is more clearly written as ";" at - line 7. | |
3955e1a9 KW |
978 | ######## |
979 | # toke.c | |
980 | use warnings 'syntax' ; | |
981 | my $a = qr/foo/du; | |
ff3f26d2 | 982 | $a = qr/foo/lai; |
3955e1a9 | 983 | $a = qr/foo/lil; |
ff3f26d2 KW |
984 | $a = qr/foo/aia; |
985 | $a = qr/foo/aaia; | |
3955e1a9 KW |
986 | no warnings 'syntax' ; |
987 | my $a = qr/foo/du; | |
988 | EXPECT | |
989 | Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= " | |
990 | Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= " | |
991 | Regexp modifier "/l" may not appear twice at - line 5, near "= " | |
ff3f26d2 KW |
992 | Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= " |
993 | BEGIN not safe after errors--compilation aborted at - line 8. | |
ba05d9aa FC |
994 | ######## |
995 | # toke.c | |
996 | # [perl #4362] | |
997 | eval "print q\xabfoo"; | |
998 | print "ok\n" if | |
999 | $@ =~ /Can't find string terminator "\xab" anywhere before EOF/; | |
1000 | EXPECT | |
1001 | ok |