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