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 | ||
599cee73 PM |
38 | Can't use \\%c to mean $%c in expression |
39 | $_ = "ab" ; s/(ab)/\1/e; | |
40 | ||
41 | Unquoted string "abc" may clash with future reserved word at - line 3. | |
42 | warn(warn_reserved | |
43 | $a = abc; | |
44 | ||
599cee73 PM |
45 | Possible attempt to separate words with commas |
46 | @a = qw(a, b, c) ; | |
47 | ||
48 | Possible attempt to put comments in qw() list | |
49 | @a = qw(a b # c) ; | |
50 | ||
599cee73 PM |
51 | %s (...) interpreted as function |
52 | print ("") | |
53 | printf ("") | |
54 | sort ("") | |
55 | ||
56 | Ambiguous use of %c{%s%s} resolved to %c%s%s | |
57 | $a = ${time[2]} | |
58 | $a = ${time{2}} | |
59 | ||
60 | ||
61 | Ambiguous use of %c{%s} resolved to %c%s | |
62 | $a = ${time} | |
63 | sub fred {} $a = ${fred} | |
64 | ||
65 | Misplaced _ in number | |
66 | $a = 1_2; | |
67 | $a = 1_2345_6; | |
68 | ||
69 | Bareword \"%s\" refers to nonexistent package | |
70 | $a = FRED:: ; | |
71 | ||
72 | Ambiguous call resolved as CORE::%s(), qualify as such or use & | |
73 | sub time {} | |
74 | my $a = time() | |
75 | ||
767a6a26 PM |
76 | Unrecognized escape \\%c passed through |
77 | $a = "\m" ; | |
78 | ||
820438b1 | 79 | Useless use of \\E. |
52ed07f6 BF |
80 | $a = "abcd\E" ; |
81 | ||
1f25714a FC |
82 | Postfix dereference is experimental |
83 | ||
767a6a26 PM |
84 | %s number > %s non-portable |
85 | my $a = 0b011111111111111111111111111111110 ; | |
86 | $a = 0b011111111111111111111111111111111 ; | |
87 | $a = 0b111111111111111111111111111111111 ; | |
88 | $a = 0x0fffffffe ; | |
89 | $a = 0x0ffffffff ; | |
90 | $a = 0x1ffffffff ; | |
91 | $a = 0037777777776 ; | |
92 | $a = 0037777777777 ; | |
93 | $a = 0047777777777 ; | |
94 | ||
95 | Integer overflow in binary number | |
96 | my $a = 0b011111111111111111111111111111110 ; | |
97 | $a = 0b011111111111111111111111111111111 ; | |
98 | $a = 0b111111111111111111111111111111111 ; | |
99 | $a = 0x0fffffffe ; | |
100 | $a = 0x0ffffffff ; | |
101 | $a = 0x1ffffffff ; | |
102 | $a = 0037777777776 ; | |
103 | $a = 0037777777777 ; | |
104 | $a = 0047777777777 ; | |
ac206dc8 RGS |
105 | |
106 | dump() better written as CORE::dump() | |
4ac733c9 MJD |
107 | |
108 | Use of /c modifier is meaningless without /g | |
109 | ||
64e578a2 MJD |
110 | Use of /c modifier is meaningless in s/// |
111 | ||
0453d815 PM |
112 | Mandatory Warnings |
113 | ------------------ | |
114 | Use of "%s" without parentheses is ambiguous [check_uni] | |
115 | rand + 4 | |
116 | ||
117 | Ambiguous use of -%s resolved as -&%s() [yylex] | |
118 | sub fred {} ; - fred ; | |
119 | ||
120 | Precedence problem: open %.*s should be open(%.*s) [yylex] | |
121 | open FOO || die; | |
122 | ||
123 | Operator or semicolon missing before %c%s [yylex] | |
124 | Ambiguous use of %c resolved as operator %c | |
125 | *foo *foo | |
126 | ||
599cee73 PM |
127 | __END__ |
128 | # toke.c | |
599cee73 PM |
129 | format STDOUT = |
130 | @<<< @||| @>>> @>>> | |
131 | $a $b "abc" 'def' | |
132 | . | |
4438c4b7 | 133 | no warnings 'deprecated' ; |
0453d815 PM |
134 | format STDOUT = |
135 | @<<< @||| @>>> @>>> | |
136 | $a $b "abc" 'def' | |
137 | . | |
599cee73 | 138 | EXPECT |
d1d15184 NC |
139 | Use of comma-less variable list is deprecated at - line 4. |
140 | Use of comma-less variable list is deprecated at - line 4. | |
141 | Use of comma-less variable list is deprecated at - line 4. | |
599cee73 PM |
142 | ######## |
143 | # toke.c | |
599cee73 PM |
144 | $a = <<; |
145 | ||
4438c4b7 | 146 | no warnings 'deprecated' ; |
0453d815 PM |
147 | $a = <<; |
148 | ||
599cee73 | 149 | EXPECT |
0da72d5e KW |
150 | Use of bare << to mean <<"" is deprecated at - line 2. |
151 | ######## | |
152 | # toke.c | |
153 | $a =~ m/$foo/eq; | |
154 | $a =~ s/$foo/fool/seq; | |
155 | ||
156 | EXPECT | |
157 | OPTION fatal | |
158 | Unknown regexp modifier "/e" at - line 2, near "=~ " | |
159 | Unknown regexp modifier "/q" at - line 2, near "=~ " | |
160 | Unknown regexp modifier "/q" at - line 3, near "=~ " | |
161 | Execution of - aborted due to compilation errors. | |
84159251 BF |
162 | ######## |
163 | # toke.c | |
164 | use utf8; | |
165 | use open qw( :utf8 :std ); | |
166 | $a =~ m/$foo/eネq; | |
167 | $a =~ s/$foo/fool/seネq; | |
168 | ||
169 | EXPECT | |
170 | OPTION fatal | |
171 | Unknown regexp modifier "/e" at - line 4, near "=~ " | |
172 | Unknown regexp modifier "/ネ" at - line 4, near "=~ " | |
173 | Unknown regexp modifier "/q" at - line 4, near "=~ " | |
174 | Unknown regexp modifier "/ネ" at - line 5, near "=~ " | |
175 | Unknown regexp modifier "/q" at - line 5, near "=~ " | |
176 | Execution of - aborted due to compilation errors. | |
599cee73 PM |
177 | ######## |
178 | # toke.c | |
4438c4b7 | 179 | use warnings 'syntax' ; |
599cee73 | 180 | s/(abc)/\1/; |
4438c4b7 | 181 | no warnings 'syntax' ; |
0453d815 | 182 | s/(abc)/\1/; |
599cee73 PM |
183 | EXPECT |
184 | \1 better written as $1 at - line 3. | |
185 | ######## | |
186 | # toke.c | |
4438c4b7 | 187 | use warnings 'semicolon' ; |
599cee73 PM |
188 | $a = 1 |
189 | &time ; | |
4438c4b7 | 190 | no warnings 'semicolon' ; |
0453d815 PM |
191 | $a = 1 |
192 | &time ; | |
599cee73 PM |
193 | EXPECT |
194 | Semicolon seems to be missing at - line 3. | |
195 | ######## | |
196 | # toke.c | |
4438c4b7 | 197 | use warnings 'syntax' ; |
599cee73 PM |
198 | my $a =+ 2 ; |
199 | $a =- 2 ; | |
200 | $a =* 2 ; | |
201 | $a =% 2 ; | |
202 | $a =& 2 ; | |
203 | $a =. 2 ; | |
204 | $a =^ 2 ; | |
205 | $a =| 2 ; | |
206 | $a =< 2 ; | |
207 | $a =/ 2 ; | |
208 | EXPECT | |
7f01dc7a JH |
209 | Reversed += operator at - line 3. |
210 | Reversed -= operator at - line 4. | |
211 | Reversed *= operator at - line 5. | |
212 | Reversed %= operator at - line 6. | |
213 | Reversed &= operator at - line 7. | |
214 | Reversed .= operator at - line 8. | |
215 | Reversed ^= operator at - line 9. | |
216 | Reversed |= operator at - line 10. | |
217 | Reversed <= operator at - line 11. | |
218 | syntax error at - line 8, near "=." | |
219 | syntax error at - line 9, near "=^" | |
220 | syntax error at - line 10, near "=|" | |
221 | Unterminated <> operator at - line 11. | |
599cee73 PM |
222 | ######## |
223 | # toke.c | |
4438c4b7 | 224 | no warnings 'syntax' ; |
0453d815 PM |
225 | my $a =+ 2 ; |
226 | $a =- 2 ; | |
227 | $a =* 2 ; | |
228 | $a =% 2 ; | |
229 | $a =& 2 ; | |
230 | $a =. 2 ; | |
231 | $a =^ 2 ; | |
232 | $a =| 2 ; | |
233 | $a =< 2 ; | |
234 | $a =/ 2 ; | |
235 | EXPECT | |
7f01dc7a JH |
236 | syntax error at - line 8, near "=." |
237 | syntax error at - line 9, near "=^" | |
238 | syntax error at - line 10, near "=|" | |
239 | Unterminated <> operator at - line 11. | |
0453d815 PM |
240 | ######## |
241 | # toke.c | |
4438c4b7 | 242 | use warnings 'syntax' ; |
599cee73 | 243 | my $a = $a[1,2] ; |
4438c4b7 | 244 | no warnings 'syntax' ; |
0453d815 | 245 | my $a = $a[1,2] ; |
599cee73 PM |
246 | EXPECT |
247 | Multidimensional syntax $a[1,2] not supported at - line 3. | |
248 | ######## | |
249 | # toke.c | |
4438c4b7 | 250 | use warnings 'syntax' ; |
599cee73 | 251 | sub fred {} ; $SIG{TERM} = fred; |
4438c4b7 | 252 | no warnings 'syntax' ; |
0453d815 | 253 | $SIG{TERM} = fred; |
599cee73 PM |
254 | EXPECT |
255 | You need to quote "fred" at - line 3. | |
256 | ######## | |
257 | # toke.c | |
4c01a014 BF |
258 | use utf8; |
259 | use open qw( :utf8 :std ); | |
260 | use warnings 'syntax' ; | |
261 | sub frèd {} ; $SIG{TERM} = frèd; | |
262 | no warnings 'syntax' ; | |
263 | $SIG{TERM} = frèd; | |
264 | EXPECT | |
265 | You need to quote "frèd" at - line 5. | |
266 | ######## | |
267 | # toke.c | |
268 | use utf8; | |
269 | use open qw( :utf8 :std ); | |
270 | use warnings 'syntax' ; | |
271 | sub ふれど {} ; $SIG{TERM} = ふれど; | |
272 | no warnings 'syntax' ; | |
273 | $SIG{TERM} = ふれど; | |
274 | EXPECT | |
275 | You need to quote "ふれど" at - line 5. | |
276 | ######## | |
277 | # toke.c | |
4438c4b7 | 278 | use warnings 'syntax' ; |
599cee73 PM |
279 | $_ = "ab" ; |
280 | s/(ab)/\1/e; | |
e37958c3 FC |
281 | s//\(2)/e; # should be exempt |
282 | s/${\2}//; # same here | |
283 | ()="${\2}"; # metoo | |
4438c4b7 | 284 | no warnings 'syntax' ; |
0453d815 PM |
285 | $_ = "ab" ; |
286 | s/(ab)/\1/e; | |
599cee73 PM |
287 | EXPECT |
288 | Can't use \1 to mean $1 in expression at - line 4. | |
289 | ######## | |
290 | # toke.c | |
4438c4b7 | 291 | use warnings 'reserved' ; |
599cee73 | 292 | $a = abc; |
1c3923b3 GS |
293 | $a = { def |
294 | ||
295 | => 1 }; | |
4438c4b7 | 296 | no warnings 'reserved' ; |
0453d815 | 297 | $a = abc; |
599cee73 PM |
298 | EXPECT |
299 | Unquoted string "abc" may clash with future reserved word at - line 3. | |
300 | ######## | |
301 | # toke.c | |
e476b1b5 | 302 | use warnings 'qw' ; |
599cee73 | 303 | @a = qw(a, b, c) ; |
e476b1b5 | 304 | no warnings 'qw' ; |
0453d815 | 305 | @a = qw(a, b, c) ; |
599cee73 PM |
306 | EXPECT |
307 | Possible attempt to separate words with commas at - line 3. | |
308 | ######## | |
309 | # toke.c | |
e476b1b5 | 310 | use warnings 'qw' ; |
7e03b518 | 311 | @a = qw(a b c # #) ; |
e476b1b5 | 312 | no warnings 'qw' ; |
7e03b518 | 313 | @a = qw(a b c # #) ; |
599cee73 PM |
314 | EXPECT |
315 | Possible attempt to put comments in qw() list at - line 3. | |
316 | ######## | |
317 | # toke.c | |
7e03b518 EB |
318 | use warnings 'qw' ; |
319 | @a = qw(a, b, c # #) ; | |
320 | no warnings 'qw' ; | |
321 | @a = qw(a, b, c # #) ; | |
322 | EXPECT | |
323 | Possible attempt to separate words with commas at - line 3. | |
324 | Possible attempt to put comments in qw() list at - line 3. | |
325 | ######## | |
326 | # toke.c | |
4438c4b7 | 327 | use warnings 'syntax' ; |
b1439985 RGS |
328 | print (""); |
329 | print ("") and $x = 1; | |
330 | print ("") or die; | |
331 | print ("") // die; | |
332 | print (1+2) * 3 if 0; # only this one should warn | |
333 | print (1+2) if 0; | |
599cee73 | 334 | EXPECT |
b1439985 | 335 | print (...) interpreted as function at - line 7. |
599cee73 PM |
336 | ######## |
337 | # toke.c | |
4438c4b7 | 338 | no warnings 'syntax' ; |
0453d815 PM |
339 | print ("") |
340 | EXPECT | |
341 | ||
342 | ######## | |
343 | # toke.c | |
4438c4b7 | 344 | use warnings 'syntax' ; |
b1439985 RGS |
345 | printf (""); |
346 | printf ("") . ''; | |
599cee73 | 347 | EXPECT |
b1439985 | 348 | printf (...) interpreted as function at - line 4. |
599cee73 PM |
349 | ######## |
350 | # toke.c | |
4438c4b7 | 351 | no warnings 'syntax' ; |
0453d815 PM |
352 | printf ("") |
353 | EXPECT | |
354 | ||
355 | ######## | |
356 | # toke.c | |
4438c4b7 | 357 | use warnings 'syntax' ; |
b1439985 RGS |
358 | sort (""); |
359 | sort ("") . ''; | |
599cee73 | 360 | EXPECT |
b1439985 | 361 | sort (...) interpreted as function at - line 4. |
599cee73 PM |
362 | ######## |
363 | # toke.c | |
4438c4b7 | 364 | no warnings 'syntax' ; |
0453d815 PM |
365 | sort ("") |
366 | EXPECT | |
367 | ||
368 | ######## | |
369 | # toke.c | |
4438c4b7 | 370 | use warnings 'ambiguous' ; |
599cee73 | 371 | $a = ${time[2]}; |
4438c4b7 | 372 | no warnings 'ambiguous' ; |
0453d815 | 373 | $a = ${time[2]}; |
599cee73 PM |
374 | EXPECT |
375 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. | |
376 | ######## | |
377 | # toke.c | |
4438c4b7 | 378 | use warnings 'ambiguous' ; |
599cee73 PM |
379 | $a = ${time{2}}; |
380 | EXPECT | |
381 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. | |
382 | ######## | |
383 | # toke.c | |
a49b10d0 BF |
384 | use warnings 'ambiguous' ; |
385 | $a = ${ | |
386 | ||
387 | time | |
388 | {2} | |
389 | }; | |
390 | warn "after"; | |
391 | EXPECT | |
392 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 5. | |
393 | after at - line 8. | |
394 | ######## | |
395 | # toke.c | |
396 | use warnings 'ambiguous' ; | |
397 | $a = ${ | |
398 | ||
399 | time[2] | |
400 | ||
401 | }; | |
402 | $a = ${ | |
403 | ||
404 | time | |
405 | [2] | |
406 | ||
407 | }; | |
408 | warn "after"; | |
409 | EXPECT | |
410 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 5. | |
411 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 10. | |
412 | after at - line 14. | |
413 | ######## | |
414 | # toke.c | |
4438c4b7 | 415 | no warnings 'ambiguous' ; |
0453d815 PM |
416 | $a = ${time{2}}; |
417 | EXPECT | |
418 | ||
419 | ######## | |
420 | # toke.c | |
4438c4b7 | 421 | use warnings 'ambiguous' ; |
599cee73 | 422 | $a = ${time} ; |
27ffb73a NC |
423 | $a = @{time} ; |
424 | $a = $#{time} ; # This one is special cased in toke.c | |
425 | $a = %{time} ; | |
426 | $a = *{time} ; | |
427 | $a = defined &{time} ; # To avoid calling &::time | |
4438c4b7 | 428 | no warnings 'ambiguous' ; |
0453d815 | 429 | $a = ${time} ; |
27ffb73a NC |
430 | $a = @{time} ; |
431 | $a = $#{time} ; # This one is special cased in toke.c | |
432 | $a = %{time} ; | |
433 | $a = *{time} ; | |
434 | $a = defined &{time} ; # To avoid calling &::time | |
599cee73 PM |
435 | EXPECT |
436 | Ambiguous use of ${time} resolved to $time at - line 3. | |
27ffb73a NC |
437 | Ambiguous use of @{time} resolved to @time at - line 4. |
438 | Ambiguous use of @{time} resolved to @time at - line 5. | |
439 | Ambiguous use of %{time} resolved to %time at - line 6. | |
440 | Ambiguous use of *{time} resolved to *time at - line 7. | |
441 | Ambiguous use of &{time} resolved to &time at - line 8. | |
599cee73 PM |
442 | ######## |
443 | # toke.c | |
4438c4b7 | 444 | use warnings 'ambiguous' ; |
a49b10d0 BF |
445 | $a = ${ |
446 | time | |
447 | } ; | |
448 | $a = @{ | |
449 | time | |
450 | } ; | |
451 | $a = $#{ | |
452 | time | |
453 | } ; | |
454 | $a = %{ | |
455 | time | |
456 | } ; | |
457 | $a = *{ | |
458 | time | |
459 | } ; | |
460 | $a = defined &{ | |
461 | time | |
462 | ||
463 | ||
464 | } ; | |
465 | warn "last"; | |
466 | EXPECT | |
467 | Ambiguous use of ${time} resolved to $time at - line 4. | |
468 | Ambiguous use of @{time} resolved to @time at - line 7. | |
469 | Ambiguous use of @{time} resolved to @time at - line 10. | |
470 | Ambiguous use of %{time} resolved to %time at - line 13. | |
471 | Ambiguous use of *{time} resolved to *time at - line 16. | |
472 | Ambiguous use of &{time} resolved to &time at - line 19. | |
473 | last at - line 23. | |
474 | ######## | |
475 | # toke.c | |
476 | use warnings 'ambiguous' ; | |
599cee73 PM |
477 | sub fred {} |
478 | $a = ${fred} ; | |
4438c4b7 | 479 | no warnings 'ambiguous' ; |
0453d815 | 480 | $a = ${fred} ; |
599cee73 PM |
481 | EXPECT |
482 | Ambiguous use of ${fred} resolved to $fred at - line 4. | |
483 | ######## | |
484 | # toke.c | |
4438c4b7 | 485 | use warnings 'syntax' ; |
7fd134d9 JH |
486 | $a = _123; print "$a\n"; #( 3 string) |
487 | $a = 1_23; print "$a\n"; | |
488 | $a = 12_3; print "$a\n"; | |
489 | $a = 123_; print "$a\n"; # 6 | |
490 | $a = _+123; print "$a\n"; # 7 string) | |
491 | $a = +_123; print "$a\n"; #( 8 string) | |
492 | $a = +1_23; print "$a\n"; | |
493 | $a = +12_3; print "$a\n"; | |
494 | $a = +123_; print "$a\n"; # 11 | |
495 | $a = _-123; print "$a\n"; #(12 string) | |
496 | $a = -_123; print "$a\n"; #(13 string) | |
497 | $a = -1_23; print "$a\n"; | |
498 | $a = -12_3; print "$a\n"; | |
499 | $a = -123_; print "$a\n"; # 16 | |
500 | $a = 123._456; print "$a\n"; # 17 | |
501 | $a = 123.4_56; print "$a\n"; | |
502 | $a = 123.45_6; print "$a\n"; | |
503 | $a = 123.456_; print "$a\n"; # 20 | |
504 | $a = +123._456; print "$a\n"; # 21 | |
505 | $a = +123.4_56; print "$a\n"; | |
506 | $a = +123.45_6; print "$a\n"; | |
507 | $a = +123.456_; print "$a\n"; # 24 | |
508 | $a = -123._456; print "$a\n"; # 25 | |
509 | $a = -123.4_56; print "$a\n"; | |
510 | $a = -123.45_6; print "$a\n"; | |
511 | $a = -123.456_; print "$a\n"; # 28 | |
2bea9a37 JH |
512 | $a = 123.456E_12; printf("%.0f\n", $a); # 29 |
513 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
514 | $a = 123.456E12_; printf("%.0f\n", $a); # 31 | |
515 | $a = 123.456E_+12; printf("%.0f\n", $a); # 32 | |
516 | $a = 123.456E+_12; printf("%.0f\n", $a); # 33 | |
517 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
518 | $a = 123.456E+12_; printf("%.0f\n", $a); # 35 | |
7fd134d9 JH |
519 | $a = 123.456E_-12; print "$a\n"; # 36 |
520 | $a = 123.456E-_12; print "$a\n"; # 37 | |
521 | $a = 123.456E-1_2; print "$a\n"; | |
522 | $a = 123.456E-12_; print "$a\n"; # 39 | |
b3b48e3e JH |
523 | $a = 1__23; print "$a\n"; # 40 |
524 | $a = 12.3__4; print "$a\n"; # 41 | |
2bea9a37 | 525 | $a = 12.34e1__2; printf("%.0f\n", $a); # 42 |
4438c4b7 | 526 | no warnings 'syntax' ; |
7fd134d9 JH |
527 | $a = _123; print "$a\n"; |
528 | $a = 1_23; print "$a\n"; | |
529 | $a = 12_3; print "$a\n"; | |
530 | $a = 123_; print "$a\n"; | |
531 | $a = _+123; print "$a\n"; | |
532 | $a = +_123; print "$a\n"; | |
533 | $a = +1_23; print "$a\n"; | |
534 | $a = +12_3; print "$a\n"; | |
535 | $a = +123_; print "$a\n"; | |
536 | $a = _-123; print "$a\n"; | |
537 | $a = -_123; print "$a\n"; | |
538 | $a = -1_23; print "$a\n"; | |
539 | $a = -12_3; print "$a\n"; | |
540 | $a = -123_; print "$a\n"; | |
541 | $a = 123._456; print "$a\n"; | |
542 | $a = 123.4_56; print "$a\n"; | |
543 | $a = 123.45_6; print "$a\n"; | |
544 | $a = 123.456_; print "$a\n"; | |
545 | $a = +123._456; print "$a\n"; | |
546 | $a = +123.4_56; print "$a\n"; | |
547 | $a = +123.45_6; print "$a\n"; | |
548 | $a = +123.456_; print "$a\n"; | |
549 | $a = -123._456; print "$a\n"; | |
550 | $a = -123.4_56; print "$a\n"; | |
551 | $a = -123.45_6; print "$a\n"; | |
552 | $a = -123.456_; print "$a\n"; | |
2bea9a37 JH |
553 | $a = 123.456E_12; printf("%.0f\n", $a); |
554 | $a = 123.456E1_2; printf("%.0f\n", $a); | |
555 | $a = 123.456E12_; printf("%.0f\n", $a); | |
556 | $a = 123.456E_+12; printf("%.0f\n", $a); | |
557 | $a = 123.456E+_12; printf("%.0f\n", $a); | |
558 | $a = 123.456E+1_2; printf("%.0f\n", $a); | |
559 | $a = 123.456E+12_; printf("%.0f\n", $a); | |
7fd134d9 JH |
560 | $a = 123.456E_-12; print "$a\n"; |
561 | $a = 123.456E-_12; print "$a\n"; | |
562 | $a = 123.456E-1_2; print "$a\n"; | |
563 | $a = 123.456E-12_; print "$a\n"; | |
b3b48e3e JH |
564 | $a = 1__23; print "$a\n"; |
565 | $a = 12.3__4; print "$a\n"; | |
2bea9a37 | 566 | $a = 12.34e1__2; printf("%.0f\n", $a); |
599cee73 | 567 | EXPECT |
fbfa96bd | 568 | OPTIONS regex |
928753ea | 569 | Misplaced _ in number at - line 6. |
928753ea | 570 | Misplaced _ in number at - line 11. |
7fd134d9 | 571 | Misplaced _ in number at - line 16. |
928753ea | 572 | Misplaced _ in number at - line 17. |
7fd134d9 | 573 | Misplaced _ in number at - line 20. |
928753ea | 574 | Misplaced _ in number at - line 21. |
7fd134d9 JH |
575 | Misplaced _ in number at - line 24. |
576 | Misplaced _ in number at - line 25. | |
577 | Misplaced _ in number at - line 28. | |
578 | Misplaced _ in number at - line 29. | |
579 | Misplaced _ in number at - line 31. | |
580 | Misplaced _ in number at - line 32. | |
581 | Misplaced _ in number at - line 33. | |
582 | Misplaced _ in number at - line 35. | |
583 | Misplaced _ in number at - line 36. | |
584 | Misplaced _ in number at - line 37. | |
585 | Misplaced _ in number at - line 39. | |
b3b48e3e JH |
586 | Misplaced _ in number at - line 40. |
587 | Misplaced _ in number at - line 41. | |
588 | Misplaced _ in number at - line 42. | |
928753ea JH |
589 | _123 |
590 | 123 | |
928753ea | 591 | 123 |
7fd134d9 JH |
592 | 123 |
593 | 123 | |
594 | _123 | |
595 | 123 | |
596 | 123 | |
597 | 123 | |
598 | -123 | |
599 | -_123 | |
600 | -123 | |
601 | -123 | |
602 | -123 | |
603 | 123.456 | |
604 | 123.456 | |
605 | 123.456 | |
606 | 123.456 | |
607 | 123.456 | |
608 | 123.456 | |
609 | 123.456 | |
610 | 123.456 | |
611 | -123.456 | |
612 | -123.456 | |
613 | -123.456 | |
614 | -123.456 | |
615 | 123456000000000 | |
616 | 123456000000000 | |
617 | 123456000000000 | |
618 | 123456000000000 | |
619 | 123456000000000 | |
620 | 123456000000000 | |
621 | 123456000000000 | |
fbfa96bd NIS |
622 | 1.23456e-0?10 |
623 | 1.23456e-0?10 | |
624 | 1.23456e-0?10 | |
625 | 1.23456e-0?10 | |
b3b48e3e JH |
626 | 123 |
627 | 12.34 | |
628 | 12340000000000 | |
7fd134d9 JH |
629 | _123 |
630 | 123 | |
631 | 123 | |
632 | 123 | |
633 | 123 | |
634 | _123 | |
635 | 123 | |
636 | 123 | |
637 | 123 | |
638 | -123 | |
639 | -_123 | |
640 | -123 | |
641 | -123 | |
642 | -123 | |
643 | 123.456 | |
644 | 123.456 | |
645 | 123.456 | |
646 | 123.456 | |
647 | 123.456 | |
928753ea JH |
648 | 123.456 |
649 | 123.456 | |
928753ea | 650 | 123.456 |
7fd134d9 JH |
651 | -123.456 |
652 | -123.456 | |
653 | -123.456 | |
654 | -123.456 | |
655 | 123456000000000 | |
656 | 123456000000000 | |
657 | 123456000000000 | |
658 | 123456000000000 | |
659 | 123456000000000 | |
660 | 123456000000000 | |
661 | 123456000000000 | |
fbfa96bd NIS |
662 | 1.23456e-0?10 |
663 | 1.23456e-0?10 | |
664 | 1.23456e-0?10 | |
665 | 1.23456e-0?10 | |
b3b48e3e JH |
666 | 123 |
667 | 12.34 | |
668 | 12340000000000 | |
599cee73 PM |
669 | ######## |
670 | # toke.c | |
e476b1b5 | 671 | use warnings 'bareword' ; |
60e6418e | 672 | #line 25 "bar" |
599cee73 | 673 | $a = FRED:: ; |
e476b1b5 | 674 | no warnings 'bareword' ; |
0453d815 PM |
675 | #line 25 "bar" |
676 | $a = FRED:: ; | |
599cee73 | 677 | EXPECT |
60e6418e | 678 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
979a1401 BF |
679 | ######## |
680 | # toke.c | |
681 | use utf8; | |
682 | use open qw( :utf8 :std ); | |
683 | use warnings 'bareword' ; | |
684 | #line 25 "bar" | |
685 | $a = FRÈD:: ; | |
686 | no warnings 'bareword' ; | |
687 | #line 25 "bar" | |
688 | $a = FRÈD:: ; | |
689 | EXPECT | |
690 | Bareword "FRÈD::" refers to nonexistent package at bar line 25. | |
691 | ######## | |
692 | # toke.c | |
693 | use utf8; | |
694 | use open qw( :utf8 :std ); | |
695 | use warnings 'bareword' ; | |
696 | #line 25 "bar" | |
697 | $a = ϞϞϞ:: ; | |
698 | no warnings 'bareword' ; | |
699 | #line 25 "bar" | |
700 | $a = ϞϞϞ:: ; | |
701 | EXPECT | |
702 | Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25. | |
599cee73 PM |
703 | ######## |
704 | # toke.c | |
4438c4b7 | 705 | use warnings 'ambiguous' ; |
599cee73 | 706 | sub time {} |
0453d815 | 707 | my $a = time() ; |
4438c4b7 | 708 | no warnings 'ambiguous' ; |
0453d815 | 709 | my $b = time() ; |
599cee73 PM |
710 | EXPECT |
711 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. | |
712 | ######## | |
713 | # toke.c | |
26d16222 | 714 | use warnings ; |
0453d815 | 715 | eval <<'EOE'; |
df0deb90 GS |
716 | # line 30 "foo" |
717 | warn "yelp"; | |
0453d815 | 718 | { |
0453d815 PM |
719 | $_ = " \x{123} " ; |
720 | } | |
721 | EOE | |
722 | EXPECT | |
df0deb90 | 723 | yelp at foo line 30. |
0453d815 PM |
724 | ######## |
725 | # toke.c | |
0453d815 | 726 | my $a = rand + 4 ; |
fbdd83da DIM |
727 | $a = rand *^H ; |
728 | $a = rand $^H ; | |
0453d815 | 729 | EXPECT |
2d5ccbba | 730 | Warning: Use of "rand" without parentheses is ambiguous at - line 2. |
0453d815 PM |
731 | ######## |
732 | # toke.c | |
733 | $^W = 0 ; | |
734 | my $a = rand + 4 ; | |
735 | { | |
4438c4b7 | 736 | no warnings 'ambiguous' ; |
0453d815 | 737 | $a = rand + 4 ; |
4438c4b7 | 738 | use warnings 'ambiguous' ; |
0453d815 PM |
739 | $a = rand + 4 ; |
740 | } | |
741 | $a = rand + 4 ; | |
742 | EXPECT | |
2d5ccbba IT |
743 | Warning: Use of "rand" without parentheses is ambiguous at - line 3. |
744 | Warning: Use of "rand" without parentheses is ambiguous at - line 8. | |
745 | Warning: Use of "rand" without parentheses is ambiguous at - line 10. | |
0453d815 | 746 | ######## |
e19a021b FC |
747 | # [perl #97110] |
748 | sub myrand(;$) { } | |
b5fb7ce3 | 749 | sub whatever($) { } |
e19a021b | 750 | my $a = myrand + 4 ; |
b5fb7ce3 | 751 | my $b = whatever + 4 ; |
e19a021b | 752 | EXPECT |
b5fb7ce3 | 753 | Warning: Use of "myrand" without parentheses is ambiguous at - line 4. |
e19a021b | 754 | ######## |
0453d815 | 755 | # toke.c |
e8ae98db RGS |
756 | use warnings "ambiguous"; |
757 | print for keys %+; # should not warn | |
758 | EXPECT | |
759 | ######## | |
7950e9cf | 760 | # toke.c [This does not warn any more.] |
0453d815 PM |
761 | sub fred {}; |
762 | -fred ; | |
898c3bca FC |
763 | sub hank : lvalue {$_} |
764 | --hank; # This should *not* warn [perl #77240] | |
0453d815 | 765 | EXPECT |
0453d815 | 766 | ######## |
7950e9cf | 767 | # toke.c [This does not warn any more.] |
0453d815 PM |
768 | $^W = 0 ; |
769 | sub fred {} ; | |
770 | -fred ; | |
771 | { | |
4438c4b7 | 772 | no warnings 'ambiguous' ; |
0453d815 | 773 | -fred ; |
4438c4b7 | 774 | use warnings 'ambiguous' ; |
0453d815 PM |
775 | -fred ; |
776 | } | |
777 | -fred ; | |
778 | EXPECT | |
0453d815 | 779 | ######## |
7950e9cf | 780 | # toke.c [This does not warn any more.] |
43b5ab4c BF |
781 | use utf8; |
782 | use open qw( :utf8 :std ); | |
783 | sub frèd {}; | |
784 | -frèd ; | |
785 | EXPECT | |
43b5ab4c | 786 | ######## |
7950e9cf | 787 | # toke.c [This does not warn any more.] |
43b5ab4c BF |
788 | $^W = 0 ; |
789 | use utf8; | |
790 | use open qw( :utf8 :std ); | |
791 | sub frèd {} ; | |
792 | -frèd ; | |
793 | { | |
794 | no warnings 'ambiguous' ; | |
795 | -frèd ; | |
796 | use warnings 'ambiguous' ; | |
797 | -frèd ; | |
798 | } | |
799 | -frèd ; | |
800 | EXPECT | |
43b5ab4c | 801 | ######## |
7950e9cf | 802 | # toke.c [This does not warn any more.] |
43b5ab4c BF |
803 | use utf8; |
804 | use open qw( :utf8 :std ); | |
805 | sub ᒍᒘᒊ {}; | |
806 | -ᒍᒘᒊ ; | |
807 | EXPECT | |
43b5ab4c | 808 | ######## |
7950e9cf | 809 | # toke.c [This does not warn any more.] |
43b5ab4c BF |
810 | $^W = 0 ; |
811 | use utf8; | |
812 | use open qw( :utf8 :std ); | |
813 | sub ᒍᒘᒊ {} ; | |
814 | -ᒍᒘᒊ ; | |
815 | { | |
816 | no warnings 'ambiguous' ; | |
817 | -ᒍᒘᒊ ; | |
818 | use warnings 'ambiguous' ; | |
819 | -ᒍᒘᒊ ; | |
820 | } | |
821 | -ᒍᒘᒊ ; | |
822 | EXPECT | |
43b5ab4c BF |
823 | ######## |
824 | # toke.c | |
0453d815 | 825 | open FOO || time; |
240d1b6f | 826 | open local *FOO; # should be ok |
0453d815 PM |
827 | EXPECT |
828 | Precedence problem: open FOO should be open(FOO) at - line 2. | |
829 | ######## | |
71aa9713 BF |
830 | # toke.c |
831 | use utf8; | |
832 | use open qw( :utf8 :std ); | |
833 | open FÒÒ || time; | |
834 | EXPECT | |
835 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4. | |
836 | ######## | |
837 | # toke.c | |
838 | use utf8; | |
839 | use open qw( :utf8 :std ); | |
840 | open ᒍOO || time; | |
841 | EXPECT | |
842 | Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4. | |
843 | ######## | |
66fbe8fb HS |
844 | # toke.c (and [perl #16184]) |
845 | open FOO => "<&0"; close FOO; | |
846 | EXPECT | |
847 | ######## | |
0453d815 PM |
848 | # toke.c |
849 | $^W = 0 ; | |
850 | open FOO || time; | |
851 | { | |
e476b1b5 | 852 | no warnings 'precedence' ; |
0453d815 | 853 | open FOO || time; |
e476b1b5 | 854 | use warnings 'precedence' ; |
0453d815 PM |
855 | open FOO || time; |
856 | } | |
857 | open FOO || time; | |
db3abe52 | 858 | open Foo::BAR; # this should not warn |
0453d815 PM |
859 | EXPECT |
860 | Precedence problem: open FOO should be open(FOO) at - line 3. | |
861 | Precedence problem: open FOO should be open(FOO) at - line 8. | |
862 | Precedence problem: open FOO should be open(FOO) at - line 10. | |
863 | ######## | |
864 | # toke.c | |
865 | $^W = 0 ; | |
71aa9713 BF |
866 | use utf8; |
867 | use open qw( :utf8 :std ); | |
868 | open FÒÒ || time; | |
869 | { | |
870 | no warnings 'precedence' ; | |
871 | open FÒÒ || time; | |
872 | use warnings 'precedence' ; | |
873 | open FÒÒ || time; | |
874 | } | |
875 | open FÒÒ || time; | |
876 | EXPECT | |
877 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5. | |
878 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10. | |
879 | Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12. | |
880 | ######## | |
881 | # toke.c | |
882 | use utf8; | |
883 | use open qw( :utf8 :std ); | |
884 | $^W = 0 ; | |
885 | open ᒍÒÒ || time; | |
886 | { | |
887 | no warnings 'precedence' ; | |
888 | open ᒍÒÒ || time; | |
889 | use warnings 'precedence' ; | |
890 | open ᒍÒÒ || time; | |
891 | } | |
892 | open ᒍÒÒ || time; | |
893 | EXPECT | |
894 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5. | |
895 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10. | |
896 | Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12. | |
897 | ######## | |
898 | # toke.c | |
899 | $^W = 0 ; | |
0453d815 PM |
900 | *foo *foo ; |
901 | { | |
4438c4b7 | 902 | no warnings 'ambiguous' ; |
0453d815 | 903 | *foo *foo ; |
4438c4b7 | 904 | use warnings 'ambiguous' ; |
0453d815 PM |
905 | *foo *foo ; |
906 | } | |
907 | *foo *foo ; | |
9700e2d3 FC |
908 | # These should not warn [perl #117535]: |
909 | foo**foo ; | |
910 | no warnings 'deprecated'; | |
911 | sort $*foo ; | |
912 | sort $ *foo ; | |
0453d815 PM |
913 | EXPECT |
914 | Operator or semicolon missing before *foo at - line 3. | |
915 | Ambiguous use of * resolved as operator * at - line 3. | |
916 | Operator or semicolon missing before *foo at - line 8. | |
917 | Ambiguous use of * resolved as operator * at - line 8. | |
918 | Operator or semicolon missing before *foo at - line 10. | |
919 | Ambiguous use of * resolved as operator * at - line 10. | |
767a6a26 PM |
920 | ######## |
921 | # toke.c | |
9700e2d3 FC |
922 | $^W = 0 ; |
923 | %foo %foo ; | |
924 | { | |
925 | no warnings 'ambiguous' ; | |
926 | %foo %foo ; | |
927 | use warnings 'ambiguous' ; | |
928 | %foo %foo ; | |
929 | } | |
930 | %foo %foo ; | |
931 | # This should not produce ambiguity warnings [perl #117535]: | |
932 | sort $%foo ; | |
933 | sort $ %foo ; | |
934 | EXPECT | |
935 | Operator or semicolon missing before %foo at - line 3. | |
936 | Ambiguous use of % resolved as operator % at - line 3. | |
937 | Operator or semicolon missing before %foo at - line 8. | |
938 | Ambiguous use of % resolved as operator % at - line 8. | |
939 | Operator or semicolon missing before %foo at - line 10. | |
940 | Ambiguous use of % resolved as operator % at - line 10. | |
941 | Bareword found where operator expected at - line 12, near "$%foo" | |
942 | (Missing operator before foo?) | |
943 | Bareword found where operator expected at - line 13, near "$ %foo" | |
944 | (Missing operator before foo?) | |
945 | Illegal modulus zero at - line 3. | |
946 | ######## | |
947 | # toke.c | |
948 | $^W = 0 ; | |
949 | &foo &foo ; | |
950 | { | |
951 | no warnings 'ambiguous' ; | |
952 | &foo &foo ; | |
953 | use warnings 'ambiguous' ; | |
954 | &foo &foo ; | |
955 | } | |
956 | &foo &foo ; | |
957 | # These should not warn produce ambiguity warnings [perl #76910]: | |
958 | foo&&foo ; | |
959 | sort $&foo ; | |
960 | sort $ &foo ; | |
961 | EXPECT | |
962 | Operator or semicolon missing before &foo at - line 3. | |
963 | Ambiguous use of & resolved as operator & at - line 3. | |
964 | Operator or semicolon missing before &foo at - line 8. | |
965 | Ambiguous use of & resolved as operator & at - line 8. | |
966 | Operator or semicolon missing before &foo at - line 10. | |
967 | Ambiguous use of & resolved as operator & at - line 10. | |
968 | Bareword found where operator expected at - line 13, near "$&foo" | |
969 | (Missing operator before foo?) | |
970 | Bareword found where operator expected at - line 14, near "$ &foo" | |
971 | (Missing operator before foo?) | |
972 | Undefined subroutine &main::foo called at - line 3. | |
973 | ######## | |
974 | # toke.c | |
02571fe8 BF |
975 | use utf8; |
976 | use open qw( :utf8 :std ); | |
977 | $^W = 0 ; | |
978 | *foo *foo ; | |
979 | { | |
980 | no warnings 'ambiguous' ; | |
981 | *foo *foo ; | |
982 | use warnings 'ambiguous' ; | |
983 | *foo *foo ; | |
984 | } | |
985 | *foo *foo ; | |
986 | EXPECT | |
987 | Operator or semicolon missing before *foo at - line 5. | |
988 | Ambiguous use of * resolved as operator * at - line 5. | |
989 | Operator or semicolon missing before *foo at - line 10. | |
990 | Ambiguous use of * resolved as operator * at - line 10. | |
991 | Operator or semicolon missing before *foo at - line 12. | |
992 | Ambiguous use of * resolved as operator * at - line 12. | |
993 | ######## | |
994 | # toke.c | |
e476b1b5 | 995 | use warnings 'misc' ; |
767a6a26 | 996 | my $a = "\m" ; |
e476b1b5 | 997 | no warnings 'misc' ; |
767a6a26 PM |
998 | $a = "\m" ; |
999 | EXPECT | |
1000 | Unrecognized escape \m passed through at - line 3. | |
1001 | ######## | |
1002 | # toke.c | |
52ed07f6 BF |
1003 | use warnings 'misc' ; |
1004 | my $a = "abcd\E" ; | |
1005 | no warnings 'misc' ; | |
1006 | $a = "abcd\E" ; | |
1007 | EXPECT | |
820438b1 | 1008 | Useless use of \E at - line 3. |
52ed07f6 BF |
1009 | ######## |
1010 | # toke.c | |
1c2511e0 | 1011 | use feature 'postderef_qq'; |
1f25714a FC |
1012 | (\$_)->$*; |
1013 | "$_->$*"; | |
1f25714a FC |
1014 | (\$_)->$*; |
1015 | "$_->$*"; | |
1016 | EXPECT | |
1f25714a FC |
1017 | ######## |
1018 | # toke.c | |
767a6a26 PM |
1019 | use warnings 'portable' ; |
1020 | my $a = 0b011111111111111111111111111111110 ; | |
1021 | $a = 0b011111111111111111111111111111111 ; | |
1022 | $a = 0b111111111111111111111111111111111 ; | |
1023 | $a = 0x0fffffffe ; | |
1024 | $a = 0x0ffffffff ; | |
1025 | $a = 0x1ffffffff ; | |
1026 | $a = 0037777777776 ; | |
1027 | $a = 0037777777777 ; | |
1028 | $a = 0047777777777 ; | |
1029 | no warnings 'portable' ; | |
1030 | $a = 0b011111111111111111111111111111110 ; | |
1031 | $a = 0b011111111111111111111111111111111 ; | |
1032 | $a = 0b111111111111111111111111111111111 ; | |
1033 | $a = 0x0fffffffe ; | |
1034 | $a = 0x0ffffffff ; | |
1035 | $a = 0x1ffffffff ; | |
1036 | $a = 0037777777776 ; | |
1037 | $a = 0037777777777 ; | |
1038 | $a = 0047777777777 ; | |
1039 | EXPECT | |
1040 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. | |
1041 | Hexadecimal number > 0xffffffff non-portable at - line 8. | |
1042 | Octal number > 037777777777 non-portable at - line 11. | |
1043 | ######## | |
1044 | # toke.c | |
1045 | use warnings 'overflow' ; | |
1046 | my $a = 0b011111111111111111111111111111110 ; | |
1047 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 1048 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
1049 | $a = 0x0fffffffe ; |
1050 | $a = 0x0ffffffff ; | |
15041a67 | 1051 | $a = 0x10000000000000000 ; |
767a6a26 PM |
1052 | $a = 0037777777776 ; |
1053 | $a = 0037777777777 ; | |
15041a67 | 1054 | $a = 002000000000000000000000; |
767a6a26 PM |
1055 | no warnings 'overflow' ; |
1056 | $a = 0b011111111111111111111111111111110 ; | |
1057 | $a = 0b011111111111111111111111111111111 ; | |
15041a67 | 1058 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 PM |
1059 | $a = 0x0fffffffe ; |
1060 | $a = 0x0ffffffff ; | |
15041a67 | 1061 | $a = 0x10000000000000000 ; |
767a6a26 PM |
1062 | $a = 0037777777776 ; |
1063 | $a = 0037777777777 ; | |
15041a67 | 1064 | $a = 002000000000000000000000; |
767a6a26 PM |
1065 | EXPECT |
1066 | Integer overflow in binary number at - line 5. | |
1067 | Integer overflow in hexadecimal number at - line 8. | |
1068 | Integer overflow in octal number at - line 11. | |
8593bda5 GS |
1069 | ######## |
1070 | # toke.c | |
ac206dc8 RGS |
1071 | BEGIN { $^C = 1; } |
1072 | use warnings 'misc'; | |
1073 | dump; | |
1074 | CORE::dump; | |
1075 | EXPECT | |
1076 | dump() better written as CORE::dump() at - line 4. | |
1077 | - syntax OK | |
1078 | ######## | |
1079 | # toke.c | |
1080 | use warnings 'misc'; | |
1081 | use subs qw/dump/; | |
93f09d7b | 1082 | sub dump { print "no warning for overridden dump\n"; } |
ac206dc8 RGS |
1083 | dump; |
1084 | EXPECT | |
93f09d7b | 1085 | no warning for overridden dump |
ac206dc8 RGS |
1086 | ######## |
1087 | # toke.c | |
8593bda5 GS |
1088 | use warnings 'ambiguous'; |
1089 | "@mjd_previously_unused_array"; | |
1090 | no warnings 'ambiguous'; | |
29fb1d0e | 1091 | "@mjd_previously_unused_array2"; |
8593bda5 GS |
1092 | EXPECT |
1093 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. | |
707afd92 MS |
1094 | ######## |
1095 | # toke.c | |
29fb1d0e BF |
1096 | use utf8; |
1097 | use open qw( :utf8 :std ); | |
1098 | use warnings 'ambiguous'; | |
1099 | "@mjd_previously_unused_àrray"; | |
1100 | no warnings 'ambiguous'; | |
1101 | "@mjd_previously_unused_àrray2"; | |
1102 | EXPECT | |
1103 | Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5. | |
1104 | ######## | |
1105 | # toke.c | |
1106 | use utf8; | |
1107 | use open qw( :utf8 :std ); | |
1108 | use warnings 'ambiguous'; | |
1109 | "@mjd_previously_unused_ぁrrぁy"; | |
1110 | no warnings 'ambiguous'; | |
1111 | "@mjd_previously_unused_ぁrrぁy2"; | |
1112 | EXPECT | |
1113 | Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5. | |
1114 | ######## | |
1115 | # toke.c | |
d8c55666 | 1116 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
1117 | use warnings 'regexp'; |
1118 | "foo" =~ /foo/c; | |
64e578a2 | 1119 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
1120 | no warnings 'regexp'; |
1121 | "foo" =~ /foo/c; | |
64e578a2 | 1122 | "foo" =~ /foo/cg; |
4ac733c9 MJD |
1123 | EXPECT |
1124 | Use of /c modifier is meaningless without /g at - line 4. | |
1125 | ######## | |
1126 | # toke.c | |
d8c55666 | 1127 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 MJD |
1128 | use warnings 'regexp'; |
1129 | $_ = "ab" ; | |
1130 | s/ab/ab/c; | |
64e578a2 | 1131 | s/ab/ab/cg; |
4ac733c9 MJD |
1132 | no warnings 'regexp'; |
1133 | s/ab/ab/c; | |
64e578a2 | 1134 | s/ab/ab/cg; |
4ac733c9 | 1135 | EXPECT |
64e578a2 MJD |
1136 | Use of /c modifier is meaningless in s/// at - line 5. |
1137 | Use of /c modifier is meaningless in s/// at - line 6. | |
d8c55666 MJD |
1138 | ######## |
1139 | -wa | |
1140 | # toke.c | |
1141 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
1142 | print "@F\n"; | |
1143 | EXPECT | |
1144 | ||
1145 | ######## | |
1146 | -w | |
1147 | # toke.c | |
1148 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings | |
1149 | print "@F\n"; | |
1150 | EXPECT | |
1151 | Possible unintended interpolation of @F in string at - line 4. | |
1152 | Name "main::F" used only once: possible typo at - line 4. | |
1153 | ######## | |
1154 | -wa | |
1155 | # toke.c | |
1156 | # 20020414 mjd-perl-patch+@plover.com | |
1157 | EXPECT | |
1158 | ||
2710853f MJD |
1159 | ######## |
1160 | # toke.c | |
1161 | # 20020414 mjd-perl-patch+@plover.com | |
1162 | # In 5.7.3, this emitted "Possible unintended interpolation" warnings | |
1163 | use warnings 'ambiguous'; | |
1164 | $s = "(@-)(@+)"; | |
1165 | EXPECT | |
1166 | ||
56da5a46 RGS |
1167 | ######## |
1168 | # toke.c | |
1169 | # mandatory warning | |
1170 | eval q/if ($a) { } elseif ($b) { }/; | |
1171 | no warnings "syntax"; | |
1172 | eval q/if ($a) { } elseif ($b) { }/; | |
1173 | EXPECT | |
1174 | elseif should be elsif at (eval 1) line 1. | |
1175 | ######## | |
1176 | # toke.c | |
1177 | # mandatory warning | |
1178 | eval q/5 6/; | |
1179 | no warnings "syntax"; | |
1180 | eval q/5 6/; | |
1181 | EXPECT | |
1182 | Number found where operator expected at (eval 1) line 1, near "5 6" | |
1183 | (Missing operator before 6?) | |
984200d0 YST |
1184 | ######## |
1185 | # toke.c | |
7fc874e8 | 1186 | use warnings "syntax"; no warnings "deprecated"; |
984200d0 YST |
1187 | $_ = $a = 1; |
1188 | $a !=~ /1/; | |
1189 | $a !=~ m#1#; | |
1190 | $a !=~/1/; | |
decca21c YST |
1191 | $a !=~ y/1//; |
1192 | $a !=~ tr/1//; | |
1193 | $a !=~ s/1//; | |
984200d0 YST |
1194 | $a != ~/1/; |
1195 | no warnings "syntax"; | |
1196 | $a !=~ /1/; | |
1197 | $a !=~ m#1#; | |
1198 | $a !=~/1/; | |
decca21c YST |
1199 | $a !=~ y/1//; |
1200 | $a !=~ tr/1//; | |
1201 | $a !=~ s/1//; | |
984200d0 YST |
1202 | EXPECT |
1203 | !=~ should be !~ at - line 4. | |
1204 | !=~ should be !~ at - line 5. | |
1205 | !=~ should be !~ at - line 6. | |
1206 | !=~ should be !~ at - line 7. | |
decca21c YST |
1207 | !=~ should be !~ at - line 8. |
1208 | !=~ should be !~ at - line 9. | |
1108974d RGS |
1209 | ######## |
1210 | # toke.c | |
1211 | our $foo :unique; | |
8e5dadda NC |
1212 | sub pam :locked; |
1213 | sub glipp :locked { | |
1214 | } | |
1215 | sub whack_eth ($) : locked { | |
1216 | } | |
d1d15184 | 1217 | no warnings 'deprecated'; |
1108974d | 1218 | our $bar :unique; |
8e5dadda NC |
1219 | sub zapeth :locked; |
1220 | sub ker_plop :locked { | |
1221 | } | |
1222 | sub swa_a_p ($) : locked { | |
1223 | } | |
1108974d | 1224 | EXPECT |
d1d15184 NC |
1225 | Use of :unique is deprecated at - line 2. |
1226 | Use of :locked is deprecated at - line 3. | |
1227 | Use of :locked is deprecated at - line 4. | |
1228 | Use of :locked is deprecated at - line 6. | |
9e8d7757 RB |
1229 | ######## |
1230 | # toke.c | |
60e04ba1 | 1231 | use warnings "syntax"; |
9e8d7757 RB |
1232 | sub proto_after_array(@$); |
1233 | sub proto_after_arref(\@$); | |
1234 | sub proto_after_arref2(\[@$]); | |
1235 | sub proto_after_arref3(\[@$]_); | |
1236 | sub proto_after_hash(%$); | |
1237 | sub proto_after_hashref(\%$); | |
1238 | sub proto_after_hashref2(\[%$]); | |
1239 | sub underscore_last_pos($_); | |
1240 | sub underscore2($_;$); | |
1241 | sub underscore_fail($_$); | |
1242 | sub underscore_after_at(@_); | |
689aac7b FC |
1243 | our sub hour (@$); |
1244 | my sub migh (@$); | |
e7d0b801 | 1245 | use feature 'state'; |
689aac7b FC |
1246 | state sub estate (@$); |
1247 | package other; | |
1248 | sub hour (@$); | |
1249 | sub migh (@$); | |
1250 | sub estate (@$); | |
9e8d7757 RB |
1251 | no warnings "syntax"; |
1252 | sub proto_after_array(@$); | |
1253 | sub proto_after_hash(%$); | |
1254 | sub underscore_fail($_$); | |
1255 | EXPECT | |
1256 | Prototype after '@' for main::proto_after_array : @$ at - line 3. | |
1257 | Prototype after '%' for main::proto_after_hash : %$ at - line 7. | |
aef2a98a | 1258 | Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12. |
9e8d7757 | 1259 | Prototype after '@' for main::underscore_after_at : @_ at - line 13. |
689aac7b FC |
1260 | Prototype after '@' for hour : @$ at - line 14. |
1261 | Prototype after '@' for migh : @$ at - line 15. | |
1262 | Prototype after '@' for estate : @$ at - line 17. | |
1263 | Prototype after '@' for hour : @$ at - line 19. | |
1264 | Prototype after '@' for migh : @$ at - line 20. | |
1265 | Prototype after '@' for estate : @$ at - line 21. | |
77772344 B |
1266 | ######## |
1267 | # toke.c | |
1268 | use warnings "ambiguous"; | |
1269 | "foo\nn" =~ /^foo$\n/; | |
1270 | "foo\nn" =~ /^foo${\}n/; | |
1271 | my $foo = qr/^foo$\n/; | |
1272 | my $bar = qr/^foo${\}n/; | |
1273 | no warnings "ambiguous"; | |
1274 | "foo\nn" =~ /^foo$\n/; | |
1275 | "foo\nn" =~ /^foo${\}n/; | |
1276 | my $foo = qr/^foo$\n/; | |
1277 | my $bar = qr/^foo${\}n/; | |
1278 | EXPECT | |
1279 | Possible unintended interpolation of $\ in regex at - line 3. | |
1280 | Possible unintended interpolation of $\ in regex at - line 5. | |
d83f38d8 NC |
1281 | ######## |
1282 | # toke.c | |
f0a2b745 KW |
1283 | use warnings 'syntax' ; |
1284 | my $a = "\o"; | |
1285 | my $a = "\o{"; | |
1286 | my $a = "\o{}"; | |
1287 | no warnings 'syntax' ; | |
1288 | my $a = "\o"; | |
1289 | my $a = "\o{"; | |
1290 | my $a = "\o{}"; | |
1291 | EXPECT | |
1292 | Missing braces on \o{} at - line 3, within string | |
1293 | Missing right brace on \o{ at - line 4, within string | |
1294 | Number with no digits at - line 5, within string | |
1295 | BEGIN not safe after errors--compilation aborted at - line 6. | |
1296 | ######## | |
1297 | # toke.c | |
1298 | use warnings 'digit' ; | |
1299 | my $a = "\o{1238456}"; | |
1300 | no warnings 'digit' ; | |
1301 | my $a = "\o{1238456}"; | |
1302 | EXPECT | |
1303 | Non-octal character '8'. Resolved as "\o{123}" at - line 3. | |
725a61d7 Z |
1304 | ######## |
1305 | # toke.c | |
1306 | use warnings; | |
c3383756 | 1307 | print ref ? "yes\n" : "no\n" foreach [], ''; # ? is unambiguosly an operator |
725a61d7 | 1308 | EXPECT |
725a61d7 Z |
1309 | yes |
1310 | no | |
c3383756 DIM |
1311 | ######## |
1312 | # toke .c | |
1313 | use warnings; | |
1314 | $a =~ ?rand?; # ? is not a regex match | |
1315 | EXPECT | |
1316 | syntax error at - line 3, near "=~ ?" | |
1317 | Execution of - aborted due to compilation errors. | |
17a3df4c KW |
1318 | ######## |
1319 | # toke.c | |
46b78aa8 KW |
1320 | BEGIN { |
1321 | if (ord('A') == 193) { | |
1322 | print "SKIPPED\n# result varies depending on which ebcdic platform"; | |
1323 | exit 0; | |
1324 | } | |
1325 | } | |
17a3df4c | 1326 | use warnings; |
17a3df4c KW |
1327 | $a = "\c,"; |
1328 | $a = "\c`"; | |
1329 | no warnings 'syntax'; | |
17a3df4c KW |
1330 | $a = "\c,"; |
1331 | $a = "\c`"; | |
17a3df4c | 1332 | EXPECT |
46b78aa8 KW |
1333 | "\c," is more clearly written simply as "l" at - line 9. |
1334 | "\c`" is more clearly written simply as "\ " at - line 10. | |
421e43ba KW |
1335 | ######## |
1336 | # toke.c | |
a27ed980 KW |
1337 | BEGIN { |
1338 | if (ord('A') == 193) { | |
1339 | print "SKIPPED\n# test is ASCII-specific"; | |
1340 | exit 0; | |
1341 | } | |
1342 | } | |
1343 | use warnings; | |
1344 | my $a = "\c{ack}"; | |
1345 | EXPECT | |
1346 | OPTION fatal | |
1347 | Use ";" instead of "\c{" at - line 9. | |
1348 | ######## | |
1349 | # toke.c | |
1350 | BEGIN { | |
1351 | if (ord('A') == 65) { | |
1352 | print "SKIPPED\n# test is EBCDIC-specific"; | |
1353 | exit 0; | |
1354 | } | |
1355 | } | |
421e43ba KW |
1356 | use warnings; |
1357 | my $a = "\c{ack}"; | |
1358 | EXPECT | |
1359 | OPTION fatal | |
a27ed980 | 1360 | Sequence "\c{" invalid at - line 9. |
3955e1a9 KW |
1361 | ######## |
1362 | # toke.c | |
9b8f4e92 KW |
1363 | my $a = "\câ"; |
1364 | EXPECT | |
1365 | OPTION fatal | |
1366 | Character following "\c" must be printable ASCII at - line 2. | |
1367 | ######## | |
1368 | # toke.c | |
3955e1a9 KW |
1369 | use warnings 'syntax' ; |
1370 | my $a = qr/foo/du; | |
ff3f26d2 | 1371 | $a = qr/foo/lai; |
3955e1a9 | 1372 | $a = qr/foo/lil; |
ff3f26d2 KW |
1373 | $a = qr/foo/aia; |
1374 | $a = qr/foo/aaia; | |
3955e1a9 KW |
1375 | no warnings 'syntax' ; |
1376 | my $a = qr/foo/du; | |
1377 | EXPECT | |
1378 | Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= " | |
1379 | Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= " | |
1380 | Regexp modifier "/l" may not appear twice at - line 5, near "= " | |
ff3f26d2 KW |
1381 | Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= " |
1382 | BEGIN not safe after errors--compilation aborted at - line 8. | |
ba05d9aa FC |
1383 | ######## |
1384 | # toke.c | |
1385 | # [perl #4362] | |
1386 | eval "print q\xabfoo"; | |
1387 | print "ok\n" if | |
1388 | $@ =~ /Can't find string terminator "\xab" anywhere before EOF/; | |
1389 | EXPECT | |
1390 | ok | |
5c66c3dd BF |
1391 | ######## |
1392 | # toke.c | |
1393 | use utf8; | |
1394 | use open qw( :utf8 :std ); | |
1395 | use warnings 'ambiguous' ; | |
1396 | sub frèd {} | |
1397 | $a = ${frèd} ; | |
1398 | no warnings 'ambiguous' ; | |
1399 | $a = ${frèd} ; | |
1400 | EXPECT | |
1401 | Ambiguous use of ${frèd} resolved to $frèd at - line 6. | |
1402 | ######## | |
1403 | # toke.c | |
1404 | use utf8; | |
1405 | use open qw( :utf8 :std ); | |
1406 | use warnings 'ambiguous' ; | |
1407 | sub f렏 {} | |
1408 | $a = ${f렏} ; | |
1409 | no warnings 'ambiguous' ; | |
1410 | $a = ${f렏} ; | |
1411 | EXPECT | |
1412 | Ambiguous use of ${f렏} resolved to $f렏 at - line 6. | |
3773592b BF |
1413 | ######## |
1414 | # toke.c | |
1415 | use utf8; | |
1416 | use open qw( :utf8 :std ); | |
1417 | use warnings; | |
1418 | CORE::렏; | |
1419 | EXPECT | |
1420 | CORE::렏 is not a keyword at - line 5. | |
5dc13276 MH |
1421 | ######## |
1422 | # toke.c | |
1423 | # [perl #16249] | |
1424 | print ''; | |
1425 | eval this_method_is_fake (); | |
1426 | EXPECT | |
1427 | Undefined subroutine &main::this_method_is_fake called at - line 4. | |
a71a1afb FC |
1428 | ######## |
1429 | # toke.c | |
1430 | # [perl #107002] Erroneous ambiguity warnings | |
1431 | sub { # do not actually call require | |
1432 | require a::b . 1; # These used to produce erroneous | |
1433 | require a::b + 1; # ambiguity warnings. | |
1434 | } | |
1435 | EXPECT | |
4d68ffa0 KW |
1436 | ######## |
1437 | # toke.c | |
412f55bb KW |
1438 | # [perl #113094], [perl #119101], since reverted so no warnings generated |
1439 | use warnings; | |
003a6439 CB |
1440 | print "aa" =~ m{^a\{1,2\}$}, "A\n"; |
1441 | print "aa" =~ m{^a\x\{61\}$}, "B\n"; | |
1442 | print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "C\n"; | |
1443 | print "a\\o" =~ m{^a\\\x\{6F\}$}, "D\n"; | |
1444 | print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "E\n"; | |
1445 | print "a\\\\o" =~ m{^a\\\\\x\{6F\}$}, "F\n"; | |
1446 | print "aa" =~ m{^a{1,2}$}, "G\n"; | |
1447 | print "aq" =~ m[^a\[a-z\]$], "H\n"; | |
1448 | print "aq" =~ m(^a\(q\)$), "I\n"; | |
4d68ffa0 | 1449 | EXPECT |
412f55bb | 1450 | Illegal hexadecimal digit '\' ignored at - line 5. |
412f55bb KW |
1451 | Illegal hexadecimal digit '\' ignored at - line 7. |
1452 | Illegal hexadecimal digit '\' ignored at - line 9. | |
003a6439 CB |
1453 | A |
1454 | B | |
1455 | 1C | |
1456 | D | |
1457 | 1E | |
1458 | F | |
1459 | 1G | |
1460 | H | |
1461 | I | |
b29f65fc BF |
1462 | ######## |
1463 | # toke.c | |
1464 | #[perl #119123] disallow literal control character variables | |
b29f65fc BF |
1465 | *{ |
1466 | Foo | |
1467 | }; # shouldn't warn on {\n, even though \n is a control character | |
1468 | EXPECT | |
46879fad DM |
1469 | ######## |
1470 | # toke.c | |
1471 | # [perl #120288] -X at start of line gave spurious warning, where X is not | |
1472 | # a filetest operator | |
1473 | -a; | |
1474 | ;-a; | |
1475 | EXPECT | |
b3089e96 AV |
1476 | ######## |
1477 | # toke.c | |
1478 | # [perl #124113] Compile-time warning with UTF8 variable in array index | |
1479 | use warnings; | |
1480 | use utf8; | |
1481 | my $𝛃 = 0; | |
1482 | my @array = (0); | |
1483 | my $v = $array[ 0 + $𝛃 ]; | |
1484 | $v = $array[ $𝛃 + 0 ]; | |
1485 | EXPECT | |
6e59c862 AV |
1486 | ######## |
1487 | # toke.c | |
1488 | # Allow Unicode here doc boundaries | |
1489 | use warnings; | |
1490 | use utf8; | |
1491 | my $v = <<EnFraçais; | |
1492 | Comme ca! | |
1493 | EnFraçais | |
1494 | print $v; | |
1495 | EXPECT | |
1496 | Comme ca! | |
8ce2ba82 AV |
1497 | ######## |
1498 | # toke.c | |
1499 | # Fix 'Use of "..." without parentheses is ambiguous' warning for | |
b59c097b AV |
1500 | # Unicode function names. If not under PERL_UNICODE, this will generate |
1501 | # a "Wide character" warning | |
8ce2ba82 AV |
1502 | use utf8; |
1503 | use warnings; | |
1504 | sub 𝛃(;$) { return 0; } | |
1505 | my $v = 𝛃 - 5; | |
1506 | EXPECT | |
b59c097b AV |
1507 | OPTION regex |
1508 | (Wide character.*\n)?Warning: Use of "𝛃" without parentheses is ambiguous |