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 | ||
820438b1 | 83 | Useless use of \\E. |
52ed07f6 BF |
84 | $a = "abcd\E" ; |
85 | ||
767a6a26 PM |
86 | %s number > %s non-portable |
87 | my $a = 0b011111111111111111111111111111110 ; | |
88 | $a = 0b011111111111111111111111111111111 ; | |
89 | $a = 0b111111111111111111111111111111111 ; | |
90 | $a = 0x0fffffffe ; | |
91 | $a = 0x0ffffffff ; | |
92 | $a = 0x1ffffffff ; | |
93 | $a = 0037777777776 ; | |
94 | $a = 0037777777777 ; | |
95 | $a = 0047777777777 ; | |
96 | ||
97 | Integer overflow in binary number | |
98 | my $a = 0b011111111111111111111111111111110 ; | |
99 | $a = 0b011111111111111111111111111111111 ; | |
100 | $a = 0b111111111111111111111111111111111 ; | |
101 | $a = 0x0fffffffe ; | |
102 | $a = 0x0ffffffff ; | |
103 | $a = 0x1ffffffff ; | |
104 | $a = 0037777777776 ; | |
105 | $a = 0037777777777 ; | |
106 | $a = 0047777777777 ; | |
ac206dc8 RGS |
107 | |
108 | dump() better written as CORE::dump() | |
4ac733c9 MJD |
109 | |
110 | Use of /c modifier is meaningless without /g | |
111 | ||
64e578a2 MJD |
112 | Use of /c modifier is meaningless in s/// |
113 | ||
0453d815 PM |
114 | Mandatory Warnings |
115 | ------------------ | |
116 | Use of "%s" without parentheses is ambiguous [check_uni] | |
117 | rand + 4 | |
118 | ||
119 | Ambiguous use of -%s resolved as -&%s() [yylex] | |
120 | sub fred {} ; - fred ; | |
121 | ||
122 | Precedence problem: open %.*s should be open(%.*s) [yylex] | |
123 | open FOO || die; | |
124 | ||
125 | Operator or semicolon missing before %c%s [yylex] | |
126 | Ambiguous use of %c resolved as operator %c | |
127 | *foo *foo | |
128 | ||
599cee73 PM |
129 | __END__ |
130 | # toke.c | |
599cee73 PM |
131 | format STDOUT = |
132 | @<<< @||| @>>> @>>> | |
133 | $a $b "abc" 'def' | |
134 | . | |
4438c4b7 | 135 | no warnings 'deprecated' ; |
0453d815 PM |
136 | format STDOUT = |
137 | @<<< @||| @>>> @>>> | |
138 | $a $b "abc" 'def' | |
139 | . | |
599cee73 | 140 | EXPECT |
d1d15184 NC |
141 | Use of comma-less variable list is deprecated at - line 4. |
142 | Use of comma-less variable list is deprecated at - line 4. | |
143 | Use of comma-less variable list is deprecated at - line 4. | |
599cee73 PM |
144 | ######## |
145 | # toke.c | |
599cee73 PM |
146 | $a = <<; |
147 | ||
4438c4b7 | 148 | no warnings 'deprecated' ; |
0453d815 PM |
149 | $a = <<; |
150 | ||
599cee73 | 151 | EXPECT |
0da72d5e KW |
152 | Use of bare << to mean <<"" is deprecated at - line 2. |
153 | ######## | |
154 | # toke.c | |
155 | $a =~ m/$foo/eq; | |
156 | $a =~ s/$foo/fool/seq; | |
157 | ||
158 | EXPECT | |
159 | OPTION fatal | |
160 | Unknown regexp modifier "/e" at - line 2, near "=~ " | |
161 | Unknown regexp modifier "/q" at - line 2, near "=~ " | |
162 | Unknown regexp modifier "/q" at - line 3, near "=~ " | |
163 | Execution of - aborted due to compilation errors. | |
599cee73 PM |
164 | ######## |
165 | # toke.c | |
4438c4b7 | 166 | use warnings 'syntax' ; |
599cee73 | 167 | s/(abc)/\1/; |
4438c4b7 | 168 | no warnings 'syntax' ; |
0453d815 | 169 | s/(abc)/\1/; |
599cee73 PM |
170 | EXPECT |
171 | \1 better written as $1 at - line 3. | |
172 | ######## | |
173 | # toke.c | |
4438c4b7 | 174 | use warnings 'semicolon' ; |
599cee73 PM |
175 | $a = 1 |
176 | &time ; | |
4438c4b7 | 177 | no warnings 'semicolon' ; |
0453d815 PM |
178 | $a = 1 |
179 | &time ; | |
599cee73 PM |
180 | EXPECT |
181 | Semicolon seems to be missing at - line 3. | |
182 | ######## | |
183 | # toke.c | |
4438c4b7 | 184 | use warnings 'syntax' ; |
599cee73 PM |
185 | my $a =+ 2 ; |
186 | $a =- 2 ; | |
187 | $a =* 2 ; | |
188 | $a =% 2 ; | |
189 | $a =& 2 ; | |
190 | $a =. 2 ; | |
191 | $a =^ 2 ; | |
192 | $a =| 2 ; | |
193 | $a =< 2 ; | |
194 | $a =/ 2 ; | |
195 | EXPECT | |
7f01dc7a JH |
196 | Reversed += operator at - line 3. |
197 | Reversed -= operator at - line 4. | |
198 | Reversed *= operator at - line 5. | |
199 | Reversed %= operator at - line 6. | |
200 | Reversed &= operator at - line 7. | |
201 | Reversed .= operator at - line 8. | |
202 | Reversed ^= operator at - line 9. | |
203 | Reversed |= operator at - line 10. | |
204 | Reversed <= operator at - line 11. | |
205 | syntax error at - line 8, near "=." | |
206 | syntax error at - line 9, near "=^" | |
207 | syntax error at - line 10, near "=|" | |
208 | Unterminated <> operator at - line 11. | |
599cee73 PM |
209 | ######## |
210 | # toke.c | |
4438c4b7 | 211 | no warnings 'syntax' ; |
0453d815 PM |
212 | my $a =+ 2 ; |
213 | $a =- 2 ; | |
214 | $a =* 2 ; | |
215 | $a =% 2 ; | |
216 | $a =& 2 ; | |
217 | $a =. 2 ; | |
218 | $a =^ 2 ; | |
219 | $a =| 2 ; | |
220 | $a =< 2 ; | |
221 | $a =/ 2 ; | |
222 | EXPECT | |
7f01dc7a JH |
223 | syntax error at - line 8, near "=." |
224 | syntax error at - line 9, near "=^" | |
225 | syntax error at - line 10, near "=|" | |
226 | Unterminated <> operator at - line 11. | |
0453d815 PM |
227 | ######## |
228 | # toke.c | |
4438c4b7 | 229 | use warnings 'syntax' ; |
599cee73 | 230 | my $a = $a[1,2] ; |
4438c4b7 | 231 | no warnings 'syntax' ; |
0453d815 | 232 | my $a = $a[1,2] ; |
599cee73 PM |
233 | EXPECT |
234 | Multidimensional syntax $a[1,2] not supported at - line 3. | |
235 | ######## | |
236 | # toke.c | |
4438c4b7 | 237 | use warnings 'syntax' ; |
599cee73 | 238 | sub fred {} ; $SIG{TERM} = fred; |
4438c4b7 | 239 | no warnings 'syntax' ; |
0453d815 | 240 | $SIG{TERM} = fred; |
599cee73 PM |
241 | EXPECT |
242 | You need to quote "fred" at - line 3. | |
243 | ######## | |
244 | # toke.c | |
4c01a014 BF |
245 | use utf8; |
246 | use open qw( :utf8 :std ); | |
247 | use warnings 'syntax' ; | |
248 | sub frèd {} ; $SIG{TERM} = frèd; | |
249 | no warnings 'syntax' ; | |
250 | $SIG{TERM} = frèd; | |
251 | EXPECT | |
252 | You need to quote "frèd" at - line 5. | |
253 | ######## | |
254 | # toke.c | |
255 | use utf8; | |
256 | use open qw( :utf8 :std ); | |
257 | use warnings 'syntax' ; | |
258 | sub ふれど {} ; $SIG{TERM} = ふれど; | |
259 | no warnings 'syntax' ; | |
260 | $SIG{TERM} = ふれど; | |
261 | EXPECT | |
262 | You need to quote "ふれど" at - line 5. | |
263 | ######## | |
264 | # toke.c | |
4438c4b7 | 265 | use warnings 'syntax' ; |
599cee73 PM |
266 | @a[3] = 2; |
267 | @a{3} = 2; | |
4438c4b7 | 268 | no warnings 'syntax' ; |
0453d815 PM |
269 | @a[3] = 2; |
270 | @a{3} = 2; | |
599cee73 PM |
271 | EXPECT |
272 | Scalar value @a[3] better written as $a[3] at - line 3. | |
273 | Scalar value @a{3} better written as $a{3} at - line 4. | |
274 | ######## | |
275 | # toke.c | |
b9e186cd BF |
276 | use utf8; |
277 | use open qw( :utf8 :std ); | |
278 | use warnings 'syntax' ; | |
279 | @à[3] = 2; | |
280 | @à{3} = 2; | |
281 | no warnings 'syntax' ; | |
282 | @à[3] = 2; | |
283 | @à{3} = 2; | |
284 | EXPECT | |
285 | Scalar value @à[3] better written as $à[3] at - line 5. | |
286 | Scalar value @à{3} better written as $à{3} at - line 6. | |
287 | ######## | |
288 | # toke.c | |
289 | use utf8; | |
290 | use open qw( :utf8 :std ); | |
291 | use warnings 'syntax' ; | |
292 | @ぁ[3] = 2; | |
293 | @ぁ{3} = 2; | |
294 | no warnings 'syntax' ; | |
295 | @ぁ[3] = 2; | |
296 | @ぁ{3} = 2; | |
297 | EXPECT | |
298 | Scalar value @ぁ[3] better written as $ぁ[3] at - line 5. | |
299 | Scalar value @ぁ{3} better written as $ぁ{3} at - line 6. | |
300 | ######## | |
301 | # toke.c | |
4438c4b7 | 302 | use warnings 'syntax' ; |
599cee73 PM |
303 | $_ = "ab" ; |
304 | s/(ab)/\1/e; | |
4438c4b7 | 305 | no warnings 'syntax' ; |
0453d815 PM |
306 | $_ = "ab" ; |
307 | s/(ab)/\1/e; | |
599cee73 PM |
308 | EXPECT |
309 | Can't use \1 to mean $1 in expression at - line 4. | |
310 | ######## | |
311 | # toke.c | |
4438c4b7 | 312 | use warnings 'reserved' ; |
599cee73 | 313 | $a = abc; |
1c3923b3 GS |
314 | $a = { def |
315 | ||
316 | => 1 }; | |
4438c4b7 | 317 | no warnings 'reserved' ; |
0453d815 | 318 | $a = abc; |
599cee73 PM |
319 | EXPECT |
320 | Unquoted string "abc" may clash with future reserved word at - line 3. | |
321 | ######## | |
322 | # toke.c | |
e476b1b5 | 323 | use warnings 'qw' ; |
599cee73 | 324 | @a = qw(a, b, c) ; |
e476b1b5 | 325 | no warnings 'qw' ; |
0453d815 | 326 | @a = qw(a, b, c) ; |
599cee73 PM |
327 | EXPECT |
328 | Possible attempt to separate words with commas at - line 3. | |
329 | ######## | |
330 | # toke.c | |
e476b1b5 | 331 | use warnings 'qw' ; |
7e03b518 | 332 | @a = qw(a b c # #) ; |
e476b1b5 | 333 | no warnings 'qw' ; |
7e03b518 | 334 | @a = qw(a b c # #) ; |
599cee73 PM |
335 | EXPECT |
336 | Possible attempt to put comments in qw() list at - line 3. | |
337 | ######## | |
338 | # toke.c | |
7e03b518 EB |
339 | use warnings 'qw' ; |
340 | @a = qw(a, b, c # #) ; | |
341 | no warnings 'qw' ; | |
342 | @a = qw(a, b, c # #) ; | |
343 | EXPECT | |
344 | Possible attempt to separate words with commas at - line 3. | |
345 | Possible attempt to put comments in qw() list at - line 3. | |
346 | ######## | |
347 | # toke.c | |
4438c4b7 | 348 | use warnings 'syntax' ; |
b1439985 RGS |
349 | print (""); |
350 | print ("") and $x = 1; | |
351 | print ("") or die; | |
352 | print ("") // die; | |
353 | print (1+2) * 3 if 0; # only this one should warn | |
354 | print (1+2) if 0; | |
599cee73 | 355 | EXPECT |
b1439985 | 356 | print (...) interpreted as function at - line 7. |
599cee73 PM |
357 | ######## |
358 | # toke.c | |
4438c4b7 | 359 | no warnings 'syntax' ; |
0453d815 PM |
360 | print ("") |
361 | EXPECT | |
362 | ||
363 | ######## | |
364 | # toke.c | |
4438c4b7 | 365 | use warnings 'syntax' ; |
b1439985 RGS |
366 | printf (""); |
367 | printf ("") . ''; | |
599cee73 | 368 | EXPECT |
b1439985 | 369 | printf (...) interpreted as function at - line 4. |
599cee73 PM |
370 | ######## |
371 | # toke.c | |
4438c4b7 | 372 | no warnings 'syntax' ; |
0453d815 PM |
373 | printf ("") |
374 | EXPECT | |
375 | ||
376 | ######## | |
377 | # toke.c | |
4438c4b7 | 378 | use warnings 'syntax' ; |
b1439985 RGS |
379 | sort (""); |
380 | sort ("") . ''; | |
599cee73 | 381 | EXPECT |
b1439985 | 382 | sort (...) interpreted as function at - line 4. |
599cee73 PM |
383 | ######## |
384 | # toke.c | |
4438c4b7 | 385 | no warnings 'syntax' ; |
0453d815 PM |
386 | sort ("") |
387 | EXPECT | |
388 | ||
389 | ######## | |
390 | # toke.c | |
4438c4b7 | 391 | use warnings 'ambiguous' ; |
599cee73 | 392 | $a = ${time[2]}; |
4438c4b7 | 393 | no warnings 'ambiguous' ; |
0453d815 | 394 | $a = ${time[2]}; |
599cee73 PM |
395 | EXPECT |
396 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. | |
397 | ######## | |
398 | # toke.c | |
4438c4b7 | 399 | use warnings 'ambiguous' ; |
599cee73 PM |
400 | $a = ${time{2}}; |
401 | EXPECT | |
402 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. | |
403 | ######## | |
404 | # toke.c | |
4438c4b7 | 405 | no warnings 'ambiguous' ; |
0453d815 PM |
406 | $a = ${time{2}}; |
407 | EXPECT | |
408 | ||
409 | ######## | |
410 | # toke.c | |
4438c4b7 | 411 | use warnings 'ambiguous' ; |
599cee73 | 412 | $a = ${time} ; |
4438c4b7 | 413 | no warnings 'ambiguous' ; |
0453d815 | 414 | $a = ${time} ; |
599cee73 PM |
415 | EXPECT |
416 | Ambiguous use of ${time} resolved to $time at - line 3. | |
417 | ######## | |
418 | # toke.c | |
4438c4b7 | 419 | use warnings 'ambiguous' ; |
599cee73 PM |
420 | sub fred {} |
421 | $a = ${fred} ; | |
4438c4b7 | 422 | no warnings 'ambiguous' ; |
0453d815 | 423 | $a = ${fred} ; |
599cee73 PM |
424 | EXPECT |
425 | Ambiguous use of ${fred} resolved to $fred at - line 4. | |
426 | ######## | |
427 | # toke.c | |
4438c4b7 | 428 | use warnings 'syntax' ; |
7fd134d9 JH |
429 | $a = _123; print "$a\n"; #( 3 string) |
430 | $a = 1_23; print "$a\n"; | |
431 | $a = 12_3; print "$a\n"; | |
432 | $a = 123_; print "$a\n"; # 6 | |
433 | $a = _+123; print "$a\n"; # 7 string) | |
434 | $a = +_123; print "$a\n"; #( 8 string) | |
435 | $a = +1_23; print "$a\n"; | |
436 | $a = +12_3; print "$a\n"; | |
437 | $a = +123_; print "$a\n"; # 11 | |
438 | $a = _-123; print "$a\n"; #(12 string) | |
439 | $a = -_123; print "$a\n"; #(13 string) | |
440 | $a = -1_23; print "$a\n"; | |
441 | $a = -12_3; print "$a\n"; | |
442 | $a = -123_; print "$a\n"; # 16 | |
443 | $a = 123._456; print "$a\n"; # 17 | |
444 | $a = 123.4_56; print "$a\n"; | |
445 | $a = 123.45_6; print "$a\n"; | |
446 | $a = 123.456_; print "$a\n"; # 20 | |
447 | $a = +123._456; print "$a\n"; # 21 | |
448 | $a = +123.4_56; print "$a\n"; | |
449 | $a = +123.45_6; print "$a\n"; | |
450 | $a = +123.456_; print "$a\n"; # 24 | |
451 | $a = -123._456; print "$a\n"; # 25 | |
452 | $a = -123.4_56; print "$a\n"; | |
453 | $a = -123.45_6; print "$a\n"; | |
454 | $a = -123.456_; print "$a\n"; # 28 | |
2bea9a37 JH |
455 | $a = 123.456E_12; printf("%.0f\n", $a); # 29 |
456 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
457 | $a = 123.456E12_; printf("%.0f\n", $a); # 31 | |
458 | $a = 123.456E_+12; printf("%.0f\n", $a); # 32 | |
459 | $a = 123.456E+_12; printf("%.0f\n", $a); # 33 | |
460 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
461 | $a = 123.456E+12_; printf("%.0f\n", $a); # 35 | |
7fd134d9 JH |
462 | $a = 123.456E_-12; print "$a\n"; # 36 |
463 | $a = 123.456E-_12; print "$a\n"; # 37 | |
464 | $a = 123.456E-1_2; print "$a\n"; | |
465 | $a = 123.456E-12_; print "$a\n"; # 39 | |
b3b48e3e JH |
466 | $a = 1__23; print "$a\n"; # 40 |
467 | $a = 12.3__4; print "$a\n"; # 41 | |
2bea9a37 | 468 | $a = 12.34e1__2; printf("%.0f\n", $a); # 42 |
4438c4b7 | 469 | no warnings 'syntax' ; |
7fd134d9 JH |
470 | $a = _123; print "$a\n"; |
471 | $a = 1_23; print "$a\n"; | |
472 | $a = 12_3; print "$a\n"; | |
473 | $a = 123_; print "$a\n"; | |
474 | $a = _+123; print "$a\n"; | |
475 | $a = +_123; print "$a\n"; | |
476 | $a = +1_23; print "$a\n"; | |
477 | $a = +12_3; print "$a\n"; | |
478 | $a = +123_; print "$a\n"; | |
479 | $a = _-123; print "$a\n"; | |
480 | $a = -_123; print "$a\n"; | |
481 | $a = -1_23; print "$a\n"; | |
482 | $a = -12_3; print "$a\n"; | |
483 | $a = -123_; print "$a\n"; | |
484 | $a = 123._456; print "$a\n"; | |
485 | $a = 123.4_56; print "$a\n"; | |
486 | $a = 123.45_6; print "$a\n"; | |
487 | $a = 123.456_; print "$a\n"; | |
488 | $a = +123._456; print "$a\n"; | |
489 | $a = +123.4_56; print "$a\n"; | |
490 | $a = +123.45_6; print "$a\n"; | |
491 | $a = +123.456_; print "$a\n"; | |
492 | $a = -123._456; print "$a\n"; | |
493 | $a = -123.4_56; print "$a\n"; | |
494 | $a = -123.45_6; print "$a\n"; | |
495 | $a = -123.456_; print "$a\n"; | |
2bea9a37 JH |
496 | $a = 123.456E_12; printf("%.0f\n", $a); |
497 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
498 | $a = 123.456E12_; printf("%.0f\n", $a); | |
499 | $a = 123.456E_+12; printf("%.0f\n", $a); | |
500 | $a = 123.456E+_12; printf("%.0f\n", $a); | |
501 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
502 | $a = 123.456E+12_; printf("%.0f\n", $a); | |
7fd134d9 JH |
503 | $a = 123.456E_-12; print "$a\n"; |
504 | $a = 123.456E-_12; print "$a\n"; | |
505 | $a = 123.456E-1_2; print "$a\n"; | |
506 | $a = 123.456E-12_; print "$a\n"; | |
b3b48e3e JH |
507 | $a = 1__23; print "$a\n"; |
508 | $a = 12.3__4; print "$a\n"; | |
2bea9a37 | 509 | $a = 12.34e1__2; printf("%.0f\n", $a); |
599cee73 | 510 | EXPECT |
fbfa96bd | 511 | OPTIONS regex |
928753ea | 512 | Misplaced _ in number at - line 6. |
928753ea | 513 | Misplaced _ in number at - line 11. |
7fd134d9 | 514 | Misplaced _ in number at - line 16. |
928753ea | 515 | Misplaced _ in number at - line 17. |
7fd134d9 | 516 | Misplaced _ in number at - line 20. |
928753ea | 517 | Misplaced _ in number at - line 21. |
7fd134d9 JH |
518 | Misplaced _ in number at - line 24. |
519 | Misplaced _ in number at - line 25. | |
520 | Misplaced _ in number at - line 28. | |
521 | Misplaced _ in number at - line 29. | |
522 | Misplaced _ in number at - line 31. | |
523 | Misplaced _ in number at - line 32. | |
524 | Misplaced _ in number at - line 33. | |
525 | Misplaced _ in number at - line 35. | |
526 | Misplaced _ in number at - line 36. | |
527 | Misplaced _ in number at - line 37. | |
528 | Misplaced _ in number at - line 39. | |
b3b48e3e JH |
529 | Misplaced _ in number at - line 40. |
530 | Misplaced _ in number at - line 41. | |
531 | Misplaced _ in number at - line 42. | |
928753ea JH |
532 | _123 |
533 | 123 | |
928753ea | 534 | 123 |
7fd134d9 JH |
535 | 123 |
536 | 123 | |
537 | _123 | |
538 | 123 | |
539 | 123 | |
540 | 123 | |
541 | -123 | |
542 | -_123 | |
543 | -123 | |
544 | -123 | |
545 | -123 | |
546 | 123.456 | |
547 | 123.456 | |
548 | 123.456 | |
549 | 123.456 | |
550 | 123.456 | |
551 | 123.456 | |
552 | 123.456 | |
553 | 123.456 | |
554 | -123.456 | |
555 | -123.456 | |
556 | -123.456 | |
557 | -123.456 | |
558 | 123456000000000 | |
559 | 123456000000000 | |
560 | 123456000000000 | |
561 | 123456000000000 | |
562 | 123456000000000 | |
563 | 123456000000000 | |
564 | 123456000000000 | |
fbfa96bd NIS |
565 | 1.23456e-0?10 |
566 | 1.23456e-0?10 | |
567 | 1.23456e-0?10 | |
568 | 1.23456e-0?10 | |
b3b48e3e JH |
569 | 123 |
570 | 12.34 | |
571 | 12340000000000 | |
7fd134d9 JH |
572 | _123 |
573 | 123 | |
574 | 123 | |
575 | 123 | |
576 | 123 | |
577 | _123 | |
578 | 123 | |
579 | 123 | |
580 | 123 | |
581 | -123 | |
582 | -_123 | |
583 | -123 | |
584 | -123 | |
585 | -123 | |
586 | 123.456 | |
587 | 123.456 | |
588 | 123.456 | |
589 | 123.456 | |
590 | 123.456 | |
928753ea JH |
591 | 123.456 |
592 | 123.456 | |
928753ea | 593 | 123.456 |
7fd134d9 JH |
594 | -123.456 |
595 | -123.456 | |
596 | -123.456 | |
597 | -123.456 | |
598 | 123456000000000 | |
599 | 123456000000000 | |
600 | 123456000000000 | |
601 | 123456000000000 | |
602 | 123456000000000 | |
603 | 123456000000000 | |
604 | 123456000000000 | |
fbfa96bd NIS |
605 | 1.23456e-0?10 |
606 | 1.23456e-0?10 | |
607 | 1.23456e-0?10 | |
608 | 1.23456e-0?10 | |
b3b48e3e JH |
609 | 123 |
610 | 12.34 | |
611 | 12340000000000 | |
599cee73 PM |
612 | ######## |
613 | # toke.c | |
e476b1b5 | 614 | use warnings 'bareword' ; |
60e6418e | 615 | #line 25 "bar" |
599cee73 | 616 | $a = FRED:: ; |
e476b1b5 | 617 | no warnings 'bareword' ; |
0453d815 PM |
618 | #line 25 "bar" |
619 | $a = FRED:: ; | |
599cee73 | 620 | EXPECT |
60e6418e | 621 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
979a1401 BF |
622 | ######## |
623 | # toke.c | |
624 | use utf8; | |
625 | use open qw( :utf8 :std ); | |
626 | use warnings 'bareword' ; | |
627 | #line 25 "bar" | |
628 | $a = FRÈD:: ; | |
629 | no warnings 'bareword' ; | |
630 | #line 25 "bar" | |
631 | $a = FRÈD:: ; | |
632 | EXPECT | |
633 | Bareword "FRÈD::" refers to nonexistent package at bar line 25. | |
634 | ######## | |
635 | # toke.c | |
636 | use utf8; | |
637 | use open qw( :utf8 :std ); | |
638 | use warnings 'bareword' ; | |
639 | #line 25 "bar" | |
640 | $a = ϞϞϞ:: ; | |
641 | no warnings 'bareword' ; | |
642 | #line 25 "bar" | |
643 | $a = ϞϞϞ:: ; | |
644 | EXPECT | |
645 | Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25. | |
599cee73 PM |
646 | ######## |
647 | # toke.c | |
4438c4b7 | 648 | use warnings 'ambiguous' ; |
599cee73 | 649 | sub time {} |
0453d815 | 650 | my $a = time() ; |
4438c4b7 | 651 | no warnings 'ambiguous' ; |
0453d815 | 652 | my $b = time() ; |
599cee73 PM |
653 | EXPECT |
654 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. | |
655 | ######## | |
656 | # toke.c | |
26d16222 | 657 | use warnings ; |
0453d815 | 658 | eval <<'EOE'; |
df0deb90 GS |
659 | # line 30 "foo" |
660 | warn "yelp"; | |
0453d815 | 661 | { |
0453d815 PM |
662 | $_ = " \x{123} " ; |
663 | } | |
664 | EOE | |
665 | EXPECT | |
df0deb90 | 666 | yelp at foo line 30. |
0453d815 PM |
667 | ######## |
668 | # toke.c | |
0453d815 | 669 | my $a = rand + 4 ; |
fbdd83da DIM |
670 | $a = rand *^H ; |
671 | $a = rand $^H ; | |
0453d815 | 672 | EXPECT |
2d5ccbba | 673 | Warning: Use of "rand" without parentheses is ambiguous at - line 2. |
0453d815 PM |
674 | ######## |
675 | # toke.c | |
676 | $^W = 0 ; | |
677 | my $a = rand + 4 ; | |
678 | { | |
4438c4b7 | 679 | no warnings 'ambiguous' ; |
0453d815 | 680 | $a = rand + 4 ; |
4438c4b7 | 681 | use warnings 'ambiguous' ; |
0453d815 PM |
682 | $a = rand + 4 ; |
683 | } | |
684 | $a = rand + 4 ; | |
685 | EXPECT | |
2d5ccbba IT |
686 | Warning: Use of "rand" without parentheses is ambiguous at - line 3. |
687 | Warning: Use of "rand" without parentheses is ambiguous at - line 8. | |
688 | Warning: Use of "rand" without parentheses is ambiguous at - line 10. | |
0453d815 | 689 | ######## |
e19a021b FC |
690 | # [perl #97110] |
691 | sub myrand(;$) { } | |
b5fb7ce3 | 692 | sub whatever($) { } |
e19a021b | 693 | my $a = myrand + 4 ; |
b5fb7ce3 | 694 | my $b = whatever + 4 ; |
e19a021b | 695 | EXPECT |
b5fb7ce3 | 696 | Warning: Use of "myrand" without parentheses is ambiguous at - line 4. |
e19a021b | 697 | ######## |
0453d815 | 698 | # toke.c |
e8ae98db RGS |
699 | use warnings "ambiguous"; |
700 | print for keys %+; # should not warn | |
701 | EXPECT | |
702 | ######## | |
703 | # toke.c | |
0453d815 PM |
704 | sub fred {}; |
705 | -fred ; | |
706 | EXPECT | |
707 | Ambiguous use of -fred resolved as -&fred() at - line 3. | |
708 | ######## | |
709 | # toke.c | |
710 | $^W = 0 ; | |
711 | sub fred {} ; | |
712 | -fred ; | |
713 | { | |
4438c4b7 | 714 | no warnings 'ambiguous' ; |
0453d815 | 715 | -fred ; |
4438c4b7 | 716 | use warnings 'ambiguous' ; |
0453d815 PM |
717 | -fred ; |
718 | } | |
719 | -fred ; | |
720 | EXPECT | |
721 | Ambiguous use of -fred resolved as -&fred() at - line 4. | |
722 | Ambiguous use of -fred resolved as -&fred() at - line 9. | |
723 | Ambiguous use of -fred resolved as -&fred() at - line 11. | |
724 | ######## | |
725 | # toke.c | |
43b5ab4c BF |
726 | use utf8; |
727 | use open qw( :utf8 :std ); | |
728 | sub frèd {}; | |
729 | -frèd ; | |
730 | EXPECT | |
731 | Ambiguous use of -frèd resolved as -&frèd() at - line 5. | |
732 | ######## | |
733 | # toke.c | |
734 | $^W = 0 ; | |
735 | use utf8; | |
736 | use open qw( :utf8 :std ); | |
737 | sub frèd {} ; | |
738 | -frèd ; | |
739 | { | |
740 | no warnings 'ambiguous' ; | |
741 | -frèd ; | |
742 | use warnings 'ambiguous' ; | |
743 | -frèd ; | |
744 | } | |
745 | -frèd ; | |
746 | EXPECT | |
747 | Ambiguous use of -frèd resolved as -&frèd() at - line 6. | |
748 | Ambiguous use of -frèd resolved as -&frèd() at - line 11. | |
749 | Ambiguous use of -frèd resolved as -&frèd() at - line 13. | |
750 | ######## | |
751 | # toke.c | |
752 | use utf8; | |
753 | use open qw( :utf8 :std ); | |
754 | sub ᒍᒘᒊ {}; | |
755 | -ᒍᒘᒊ ; | |
756 | EXPECT | |
757 | Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 5. | |
758 | ######## | |
759 | # toke.c | |
760 | $^W = 0 ; | |
761 | use utf8; | |
762 | use open qw( :utf8 :std ); | |
763 | sub ᒍᒘᒊ {} ; | |
764 | -ᒍᒘᒊ ; | |
765 | { | |
766 | no warnings 'ambiguous' ; | |
767 | -ᒍᒘᒊ ; | |
768 | use warnings 'ambiguous' ; | |
769 | -ᒍᒘᒊ ; | |
770 | } | |
771 | -ᒍᒘᒊ ; | |
772 | EXPECT | |
773 | Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 6. | |
774 | Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 11. | |
775 | Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 13. | |
776 | ######## | |
777 | # toke.c | |
0453d815 | 778 | open FOO || time; |
240d1b6f | 779 | open local *FOO; # should be ok |
0453d815 PM |
780 | EXPECT |
781 | Precedence problem: open FOO should be open(FOO) at - line 2. | |
782 | ######## | |
71aa9713 BF |
783 | # toke.c |
784 | use utf8; | |
785 | use open qw( :utf8 :std ); | |
786 | open FÒÒ || time; | |
787 | EXPECT | |
788 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4. | |
789 | ######## | |
790 | # toke.c | |
791 | use utf8; | |
792 | use open qw( :utf8 :std ); | |
793 | open ᒍOO || time; | |
794 | EXPECT | |
795 | Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4. | |
796 | ######## | |
66fbe8fb HS |
797 | # toke.c (and [perl #16184]) |
798 | open FOO => "<&0"; close FOO; | |
799 | EXPECT | |
800 | ######## | |
0453d815 PM |
801 | # toke.c |
802 | $^W = 0 ; | |
803 | open FOO || time; | |
804 | { | |
e476b1b5 | 805 | no warnings 'precedence' ; |
0453d815 | 806 | open FOO || time; |
e476b1b5 | 807 | use warnings 'precedence' ; |
0453d815 PM |
808 | open FOO || time; |
809 | } | |
810 | open FOO || time; | |
db3abe52 | 811 | open Foo::BAR; # this should not warn |
0453d815 PM |
812 | EXPECT |
813 | Precedence problem: open FOO should be open(FOO) at - line 3. | |
814 | Precedence problem: open FOO should be open(FOO) at - line 8. | |
815 | Precedence problem: open FOO should be open(FOO) at - line 10. | |
816 | ######## | |
817 | # toke.c | |
818 | $^W = 0 ; | |
71aa9713 BF |
819 | use utf8; |
820 | use open qw( :utf8 :std ); | |
821 | open FÒÒ || time; | |
822 | { | |
823 | no warnings 'precedence' ; | |
824 | open FÒÒ || time; | |
825 | use warnings 'precedence' ; | |
826 | open FÒÒ || time; | |
827 | } | |
828 | open FÒÒ || time; | |
829 | EXPECT | |
830 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5. | |
831 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10. | |
832 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12. | |
833 | ######## | |
834 | # toke.c | |
835 | use utf8; | |
836 | use open qw( :utf8 :std ); | |
837 | $^W = 0 ; | |
838 | open ᒍÒÒ || time; | |
839 | { | |
840 | no warnings 'precedence' ; | |
841 | open ᒍÒÒ || time; | |
842 | use warnings 'precedence' ; | |
843 | open ᒍÒÒ || time; | |
844 | } | |
845 | open ᒍÒÒ || time; | |
846 | EXPECT | |
847 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5. | |
848 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10. | |
849 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12. | |
850 | ######## | |
851 | # toke.c | |
852 | $^W = 0 ; | |
0453d815 PM |
853 | *foo *foo ; |
854 | { | |
4438c4b7 | 855 | no warnings 'ambiguous' ; |
0453d815 | 856 | *foo *foo ; |
4438c4b7 | 857 | use warnings 'ambiguous' ; |
0453d815 PM |
858 | *foo *foo ; |
859 | } | |
860 | *foo *foo ; | |
861 | EXPECT | |
862 | Operator or semicolon missing before *foo at - line 3. | |
863 | Ambiguous use of * resolved as operator * at - line 3. | |
864 | Operator or semicolon missing before *foo at - line 8. | |
865 | Ambiguous use of * resolved as operator * at - line 8. | |
866 | Operator or semicolon missing before *foo at - line 10. | |
867 | Ambiguous use of * resolved as operator * at - line 10. | |
767a6a26 PM |
868 | ######## |
869 | # toke.c | |
02571fe8 BF |
870 | use utf8; |
871 | use open qw( :utf8 :std ); | |
872 | $^W = 0 ; | |
873 | *foo *foo ; | |
874 | { | |
875 | no warnings 'ambiguous' ; | |
876 | *foo *foo ; | |
877 | use warnings 'ambiguous' ; | |
878 | *foo *foo ; | |
879 | } | |
880 | *foo *foo ; | |
881 | EXPECT | |
882 | Operator or semicolon missing before *foo at - line 5. | |
883 | Ambiguous use of * resolved as operator * at - line 5. | |
884 | Operator or semicolon missing before *foo at - line 10. | |
885 | Ambiguous use of * resolved as operator * at - line 10. | |
886 | Operator or semicolon missing before *foo at - line 12. | |
887 | Ambiguous use of * resolved as operator * at - line 12. | |
888 | ######## | |
889 | # toke.c | |
e476b1b5 | 890 | use warnings 'misc' ; |
767a6a26 | 891 | my $a = "\m" ; |
e476b1b5 | 892 | no warnings 'misc' ; |
767a6a26 PM |
893 | $a = "\m" ; |
894 | EXPECT | |
895 | Unrecognized escape \m passed through at - line 3. | |
896 | ######## | |
897 | # toke.c | |
52ed07f6 BF |
898 | use warnings 'misc' ; |
899 | my $a = "abcd\E" ; | |
900 | no warnings 'misc' ; | |
901 | $a = "abcd\E" ; | |
902 | EXPECT | |
820438b1 | 903 | Useless use of \E at - line 3. |
52ed07f6 BF |
904 | ######## |
905 | # toke.c | |
767a6a26 PM |
906 | use warnings 'portable' ; |
907 | my $a = 0b011111111111111111111111111111110 ; | |
908 | $a = 0b011111111111111111111111111111111 ; | |
909 | $a = 0b111111111111111111111111111111111 ; | |
910 | $a = 0x0fffffffe ; | |
911 | $a = 0x0ffffffff ; | |
912 | $a = 0x1ffffffff ; | |
913 | $a = 0037777777776 ; | |
914 | $a = 0037777777777 ; | |
915 | $a = 0047777777777 ; | |
916 | no warnings 'portable' ; | |
917 | $a = 0b011111111111111111111111111111110 ; | |
918 | $a = 0b011111111111111111111111111111111 ; | |
919 | $a = 0b111111111111111111111111111111111 ; | |
920 | $a = 0x0fffffffe ; | |
921 | $a = 0x0ffffffff ; | |
922 | $a = 0x1ffffffff ; | |
923 | $a = 0037777777776 ; | |
924 | $a = 0037777777777 ; | |
925 | $a = 0047777777777 ; | |
926 | EXPECT | |
927 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. | |
928 | Hexadecimal number > 0xffffffff non-portable at - line 8. | |
929 | Octal number > 037777777777 non-portable at - line 11. | |
930 | ######## | |
931 | # toke.c | |
932 | use warnings 'overflow' ; | |
933 | my $a = 0b011111111111111111111111111111110 ; | |
934 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 935 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
936 | $a = 0x0fffffffe ; |
937 | $a = 0x0ffffffff ; | |
15041a67 | 938 | $a = 0x10000000000000000 ; |
767a6a26 PM |
939 | $a = 0037777777776 ; |
940 | $a = 0037777777777 ; | |
15041a67 | 941 | $a = 002000000000000000000000; |
767a6a26 PM |
942 | no warnings 'overflow' ; |
943 | $a = 0b011111111111111111111111111111110 ; | |
944 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 945 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
946 | $a = 0x0fffffffe ; |
947 | $a = 0x0ffffffff ; | |
15041a67 | 948 | $a = 0x10000000000000000 ; |
767a6a26 PM |
949 | $a = 0037777777776 ; |
950 | $a = 0037777777777 ; | |
15041a67 | 951 | $a = 002000000000000000000000; |
767a6a26 PM |
952 | EXPECT |
953 | Integer overflow in binary number at - line 5. | |
954 | Integer overflow in hexadecimal number at - line 8. | |
955 | Integer overflow in octal number at - line 11. | |
8593bda5 GS |
956 | ######## |
957 | # toke.c | |
ac206dc8 RGS |
958 | BEGIN { $^C = 1; } |
959 | use warnings 'misc'; | |
960 | dump; | |
961 | CORE::dump; | |
962 | EXPECT | |
963 | dump() better written as CORE::dump() at - line 4. | |
964 | - syntax OK | |
965 | ######## | |
966 | # toke.c | |
967 | use warnings 'misc'; | |
968 | use subs qw/dump/; | |
93f09d7b | 969 | sub dump { print "no warning for overridden dump\n"; } |
ac206dc8 RGS |
970 | dump; |
971 | EXPECT | |
93f09d7b | 972 | no warning for overridden dump |
ac206dc8 RGS |
973 | ######## |
974 | # toke.c | |
8593bda5 GS |
975 | use warnings 'ambiguous'; |
976 | "@mjd_previously_unused_array"; | |
977 | no warnings 'ambiguous'; | |
29fb1d0e | 978 | "@mjd_previously_unused_array2"; |
8593bda5 GS |
979 | EXPECT |
980 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. | |
707afd92 MS |
981 | ######## |
982 | # toke.c | |
29fb1d0e BF |
983 | use utf8; |
984 | use open qw( :utf8 :std ); | |
985 | use warnings 'ambiguous'; | |
986 | "@mjd_previously_unused_àrray"; | |
987 | no warnings 'ambiguous'; | |
988 | "@mjd_previously_unused_àrray2"; | |
989 | EXPECT | |
990 | Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5. | |
991 | ######## | |
992 | # toke.c | |
993 | use utf8; | |
994 | use open qw( :utf8 :std ); | |
995 | use warnings 'ambiguous'; | |
996 | "@mjd_previously_unused_ぁrrぁy"; | |
997 | no warnings 'ambiguous'; | |
998 | "@mjd_previously_unused_ぁrrぁy2"; | |
999 | EXPECT | |
1000 | Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5. | |
1001 | ######## | |
1002 | # toke.c | |
d8c55666 | 1003 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
1004 | use warnings 'regexp'; |
1005 | "foo" =~ /foo/c; | |
64e578a2 | 1006 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
1007 | no warnings 'regexp'; |
1008 | "foo" =~ /foo/c; | |
64e578a2 | 1009 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
1010 | EXPECT |
1011 | Use of /c modifier is meaningless without /g at - line 4. | |
1012 | ######## | |
1013 | # toke.c | |
d8c55666 | 1014 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
1015 | use warnings 'regexp'; |
1016 | $_ = "ab" ; | |
1017 | s/ab/ab/c; | |
64e578a2 | 1018 | s/ab/ab/cg; |
4ac733c9 MJD |
1019 | no warnings 'regexp'; |
1020 | s/ab/ab/c; | |
64e578a2 | 1021 | s/ab/ab/cg; |
4ac733c9 | 1022 | EXPECT |
64e578a2 MJD |
1023 | Use of /c modifier is meaningless in s/// at - line 5. |
1024 | Use of /c modifier is meaningless in s/// at - line 6. | |
d8c55666 MJD |
1025 | ######## |
1026 | -wa | |
1027 | # toke.c | |
1028 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
1029 | print "@F\n"; | |
1030 | EXPECT | |
1031 | ||
1032 | ######## | |
1033 | -w | |
1034 | # toke.c | |
1035 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
1036 | print "@F\n"; | |
1037 | EXPECT | |
1038 | Possible unintended interpolation of @F in string at - line 4. | |
1039 | Name "main::F" used only once: possible typo at - line 4. | |
1040 | ######## | |
1041 | -wa | |
1042 | # toke.c | |
1043 | # 20020414 mjd-perl-patch+@plover.com | |
1044 | EXPECT | |
1045 | ||
2710853f MJD |
1046 | ######## |
1047 | # toke.c | |
1048 | # 20020414 mjd-perl-patch+@plover.com | |
1049 | # In 5.7.3, this emitted "Possible unintended interpolation" warnings | |
1050 | use warnings 'ambiguous'; | |
1051 | $s = "(@-)(@+)"; | |
1052 | EXPECT | |
1053 | ||
56da5a46 RGS |
1054 | ######## |
1055 | # toke.c | |
1056 | # mandatory warning | |
1057 | eval q/if ($a) { } elseif ($b) { }/; | |
1058 | no warnings "syntax"; | |
1059 | eval q/if ($a) { } elseif ($b) { }/; | |
1060 | EXPECT | |
1061 | elseif should be elsif at (eval 1) line 1. | |
1062 | ######## | |
1063 | # toke.c | |
1064 | # mandatory warning | |
1065 | eval q/5 6/; | |
1066 | no warnings "syntax"; | |
1067 | eval q/5 6/; | |
1068 | EXPECT | |
1069 | Number found where operator expected at (eval 1) line 1, near "5 6" | |
1070 | (Missing operator before 6?) | |
984200d0 YST |
1071 | ######## |
1072 | # toke.c | |
1073 | use warnings "syntax"; | |
1074 | $_ = $a = 1; | |
1075 | $a !=~ /1/; | |
1076 | $a !=~ m#1#; | |
1077 | $a !=~/1/; | |
1078 | $a !=~ ?/?; | |
decca21c YST |
1079 | $a !=~ y/1//; |
1080 | $a !=~ tr/1//; | |
1081 | $a !=~ s/1//; | |
984200d0 YST |
1082 | $a != ~/1/; |
1083 | no warnings "syntax"; | |
1084 | $a !=~ /1/; | |
1085 | $a !=~ m#1#; | |
1086 | $a !=~/1/; | |
1087 | $a !=~ ?/?; | |
decca21c YST |
1088 | $a !=~ y/1//; |
1089 | $a !=~ tr/1//; | |
1090 | $a !=~ s/1//; | |
984200d0 YST |
1091 | EXPECT |
1092 | !=~ should be !~ at - line 4. | |
1093 | !=~ should be !~ at - line 5. | |
1094 | !=~ should be !~ at - line 6. | |
1095 | !=~ should be !~ at - line 7. | |
decca21c YST |
1096 | !=~ should be !~ at - line 8. |
1097 | !=~ should be !~ at - line 9. | |
1098 | !=~ should be !~ at - line 10. | |
1108974d RGS |
1099 | ######## |
1100 | # toke.c | |
1101 | our $foo :unique; | |
8e5dadda NC |
1102 | sub pam :locked; |
1103 | sub glipp :locked { | |
1104 | } | |
1105 | sub whack_eth ($) : locked { | |
1106 | } | |
d1d15184 | 1107 | no warnings 'deprecated'; |
1108974d | 1108 | our $bar :unique; |
8e5dadda NC |
1109 | sub zapeth :locked; |
1110 | sub ker_plop :locked { | |
1111 | } | |
1112 | sub swa_a_p ($) : locked { | |
1113 | } | |
1108974d | 1114 | EXPECT |
d1d15184 NC |
1115 | Use of :unique is deprecated at - line 2. |
1116 | Use of :locked is deprecated at - line 3. | |
1117 | Use of :locked is deprecated at - line 4. | |
1118 | Use of :locked is deprecated at - line 6. | |
9e8d7757 RB |
1119 | ######## |
1120 | # toke.c | |
1121 | use warnings "syntax"; | |
1122 | sub proto_after_array(@$); | |
1123 | sub proto_after_arref(\@$); | |
1124 | sub proto_after_arref2(\[@$]); | |
1125 | sub proto_after_arref3(\[@$]_); | |
1126 | sub proto_after_hash(%$); | |
1127 | sub proto_after_hashref(\%$); | |
1128 | sub proto_after_hashref2(\[%$]); | |
1129 | sub underscore_last_pos($_); | |
1130 | sub underscore2($_;$); | |
1131 | sub underscore_fail($_$); | |
1132 | sub underscore_after_at(@_); | |
1133 | no warnings "syntax"; | |
1134 | sub proto_after_array(@$); | |
1135 | sub proto_after_hash(%$); | |
1136 | sub underscore_fail($_$); | |
1137 | EXPECT | |
1138 | Prototype after '@' for main::proto_after_array : @$ at - line 3. | |
1139 | Prototype after '%' for main::proto_after_hash : %$ at - line 7. | |
aef2a98a | 1140 | Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12. |
9e8d7757 | 1141 | Prototype after '@' for main::underscore_after_at : @_ at - line 13. |
77772344 B |
1142 | ######## |
1143 | # toke.c | |
1144 | use warnings "ambiguous"; | |
1145 | "foo\nn" =~ /^foo$\n/; | |
1146 | "foo\nn" =~ /^foo${\}n/; | |
1147 | my $foo = qr/^foo$\n/; | |
1148 | my $bar = qr/^foo${\}n/; | |
1149 | no warnings "ambiguous"; | |
1150 | "foo\nn" =~ /^foo$\n/; | |
1151 | "foo\nn" =~ /^foo${\}n/; | |
1152 | my $foo = qr/^foo$\n/; | |
1153 | my $bar = qr/^foo${\}n/; | |
1154 | EXPECT | |
1155 | Possible unintended interpolation of $\ in regex at - line 3. | |
1156 | Possible unintended interpolation of $\ in regex at - line 5. | |
d83f38d8 NC |
1157 | ######## |
1158 | # toke.c | |
f0a2b745 KW |
1159 | use warnings 'syntax' ; |
1160 | my $a = "\o"; | |
1161 | my $a = "\o{"; | |
1162 | my $a = "\o{}"; | |
1163 | no warnings 'syntax' ; | |
1164 | my $a = "\o"; | |
1165 | my $a = "\o{"; | |
1166 | my $a = "\o{}"; | |
1167 | EXPECT | |
1168 | Missing braces on \o{} at - line 3, within string | |
1169 | Missing right brace on \o{ at - line 4, within string | |
1170 | Number with no digits at - line 5, within string | |
1171 | BEGIN not safe after errors--compilation aborted at - line 6. | |
1172 | ######## | |
1173 | # toke.c | |
1174 | use warnings 'digit' ; | |
1175 | my $a = "\o{1238456}"; | |
1176 | no warnings 'digit' ; | |
1177 | my $a = "\o{1238456}"; | |
1178 | EXPECT | |
1179 | Non-octal character '8'. Resolved as "\o{123}" at - line 3. | |
725a61d7 Z |
1180 | ######## |
1181 | # toke.c | |
1182 | use warnings; | |
1183 | my $a = "foo"; | |
1184 | print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2; | |
1185 | EXPECT | |
1186 | Use of ?PATTERN? without explicit operator is deprecated at - line 4. | |
1187 | yes | |
1188 | no | |
1189 | no | |
17a3df4c KW |
1190 | ######## |
1191 | # toke.c | |
1192 | use warnings; | |
1193 | my $a = "\c{ack}"; | |
1194 | $a = "\c,"; | |
1195 | $a = "\c`"; | |
1196 | no warnings 'syntax'; | |
1197 | $a = "\c{ack}"; | |
1198 | $a = "\c,"; | |
1199 | $a = "\c`"; | |
1200 | no warnings 'deprecated'; | |
1201 | EXPECT | |
1202 | "\c{" is deprecated and is more clearly written as ";" at - line 3. | |
1203 | "\c," is more clearly written simply as "l" at - line 4. | |
1204 | "\c`" is more clearly written simply as "\ " at - line 5. | |
1205 | "\c{" is deprecated and is more clearly written as ";" at - line 7. | |
3955e1a9 KW |
1206 | ######## |
1207 | # toke.c | |
1208 | use warnings 'syntax' ; | |
1209 | my $a = qr/foo/du; | |
ff3f26d2 | 1210 | $a = qr/foo/lai; |
3955e1a9 | 1211 | $a = qr/foo/lil; |
ff3f26d2 KW |
1212 | $a = qr/foo/aia; |
1213 | $a = qr/foo/aaia; | |
3955e1a9 KW |
1214 | no warnings 'syntax' ; |
1215 | my $a = qr/foo/du; | |
1216 | EXPECT | |
1217 | Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= " | |
1218 | Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= " | |
1219 | Regexp modifier "/l" may not appear twice at - line 5, near "= " | |
ff3f26d2 KW |
1220 | Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= " |
1221 | BEGIN not safe after errors--compilation aborted at - line 8. | |
ba05d9aa FC |
1222 | ######## |
1223 | # toke.c | |
1224 | # [perl #4362] | |
1225 | eval "print q\xabfoo"; | |
1226 | print "ok\n" if | |
1227 | $@ =~ /Can't find string terminator "\xab" anywhere before EOF/; | |
1228 | EXPECT | |
1229 | ok | |
5c66c3dd BF |
1230 | ######## |
1231 | # toke.c | |
1232 | use utf8; | |
1233 | use open qw( :utf8 :std ); | |
1234 | use warnings 'ambiguous' ; | |
1235 | sub frèd {} | |
1236 | $a = ${frèd} ; | |
1237 | no warnings 'ambiguous' ; | |
1238 | $a = ${frèd} ; | |
1239 | EXPECT | |
1240 | Ambiguous use of ${frèd} resolved to $frèd at - line 6. | |
1241 | ######## | |
1242 | # toke.c | |
1243 | use utf8; | |
1244 | use open qw( :utf8 :std ); | |
1245 | use warnings 'ambiguous' ; | |
1246 | sub f렏 {} | |
1247 | $a = ${f렏} ; | |
1248 | no warnings 'ambiguous' ; | |
1249 | $a = ${f렏} ; | |
1250 | EXPECT | |
1251 | Ambiguous use of ${f렏} resolved to $f렏 at - line 6. | |
3773592b BF |
1252 | ######## |
1253 | # toke.c | |
1254 | use utf8; | |
1255 | use open qw( :utf8 :std ); | |
1256 | use warnings; | |
1257 | CORE::렏; | |
1258 | EXPECT | |
1259 | CORE::렏 is not a keyword at - line 5. |