1toke.c AOK 2 3 we seem to have lost a few ambiguous warnings!! 4 5 Prototype after '@' for main::foo 6 sub foo (@$) 7 8 Illegal character in prototype for main::foo 9 sub foo (x) 10 11 \1 better written as $1 12 use warnings 'syntax' ; 13 s/(abc)/\1/; 14 15 warn(warn_nosemi) 16 Semicolon seems to be missing 17 $a = 1 18 &time ; 19 20 21 Reversed %c= operator 22 my $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 $a =/ 2 ; 32 33 Multidimensional syntax %.*s not supported 34 my $a = $a[1,2] ; 35 36 You need to quote \"%s\"" 37 sub fred {} ; $SIG{TERM} = fred; 38 39 Can't use \\%c to mean $%c in expression 40 $_ = "ab" ; s/(ab)/\1/e; 41 42 Unquoted string "abc" may clash with future reserved word at - line 3. 43 warn(warn_reserved 44 $a = abc; 45 46 Possible attempt to separate words with commas 47 @a = qw(a, b, c) ; 48 49 Possible attempt to put comments in qw() list 50 @a = qw(a b # c) ; 51 52 %s (...) interpreted as function 53 print ("") 54 printf ("") 55 sort ("") 56 57 Old package separator used in string 58 "$foo'bar" 59 "@foo'bar" 60 "$#foo'bar" 61 62 Ambiguous use of %c{%s%s} resolved to %c%s%s 63 $a = ${time[2]} 64 $a = ${time{2}} 65 66 67 Ambiguous use of %c{%s} resolved to %c%s 68 $a = ${time} 69 sub fred {} $a = ${fred} 70 71 Misplaced _ in number 72 $a = 1_2; 73 $a = 1_2345_6; 74 75 Bareword \"%s\" refers to nonexistent package 76 $a = FRED:: ; 77 78 Ambiguous call resolved as CORE::%s(), qualify as such or use & 79 sub time {} 80 my $a = time() 81 82 Unrecognized escape \\%c passed through 83 $a = "\m" ; 84 85 Useless use of \\E. 86 $a = "abcd\E" ; 87 88 Postfix dereference is experimental 89 90 %s number > %s non-portable 91 my $a = 0b011111111111111111111111111111110 ; 92 $a = 0b011111111111111111111111111111111 ; 93 $a = 0b111111111111111111111111111111111 ; 94 $a = 0x0fffffffe ; 95 $a = 0x0ffffffff ; 96 $a = 0x1ffffffff ; 97 $a = 0037777777776 ; 98 $a = 0037777777777 ; 99 $a = 0047777777777 ; 100 101 Integer overflow in binary number 102 my $a = 0b011111111111111111111111111111110 ; 103 $a = 0b011111111111111111111111111111111 ; 104 $a = 0b111111111111111111111111111111111 ; 105 $a = 0x0fffffffe ; 106 $a = 0x0ffffffff ; 107 $a = 0x1ffffffff ; 108 $a = 0037777777776 ; 109 $a = 0037777777777 ; 110 $a = 0047777777777 ; 111 112 dump() better written as CORE::dump() 113 114 Use of /c modifier is meaningless without /g 115 116 Use of /c modifier is meaningless in s/// 117 118 Mandatory Warnings 119 ------------------ 120 Use of "%s" without parentheses is ambiguous [check_uni] 121 rand + 4 122 123 Ambiguous use of -%s resolved as -&%s() [yylex] 124 sub fred {} ; - fred ; 125 126 Precedence problem: open %.*s should be open(%.*s) [yylex] 127 open FOO || die; 128 129 Operator or semicolon missing before %c%s [yylex] 130 Ambiguous use of %c resolved as operator %c 131 *foo *foo 132 133__END__ 134use utf8; 135use open qw( :utf8 :std ); 136use warnings; 137eval "sub fòò (@\$\0) {}"; 138EXPECT 139Prototype after '@' for main::fòò : @$\0 at (eval 1) line 1. 140Illegal character in prototype for main::fòò : @$\0 at (eval 1) line 1. 141######## 142use utf8; 143use open qw( :utf8 :std ); 144use warnings; 145eval "sub foo (@\0) {}"; 146eval "sub foo2 :prototype(@\0) {}"; 147EXPECT 148Prototype after '@' for main::foo : @\0 at (eval 1) line 1. 149Illegal character in prototype for main::foo : @\0 at (eval 1) line 1. 150Prototype after '@' for main::foo2 : @\x{0} at (eval 2) line 1. 151Illegal character in prototype for main::foo2 : @\x{0} at (eval 2) line 1. 152######## 153BEGIN { 154 if (ord('A') == 193) { 155 print "SKIPPED\n# Different results on EBCDIC"; 156 exit 0; 157 } 158} 159use utf8; 160use open qw( :utf8 :std ); 161use warnings; 162BEGIN { $::{"foo"} = "\@\$\0L\351on" } 163BEGIN { eval "sub foo (@\$\0L\x{c3}\x{a9}on) {}"; } 164EXPECT 165Prototype after '@' for main::foo : @$\x{0}L... at (eval 1) line 1. 166Illegal character in prototype for main::foo : @$\x{0}L... at (eval 1) line 1. 167######## 168use utf8; 169use open qw( :utf8 :std ); 170use warnings; 171BEGIN { eval "sub foo (@\0) {}"; } 172EXPECT 173Prototype after '@' for main::foo : @\0 at (eval 1) line 1. 174Illegal character in prototype for main::foo : @\0 at (eval 1) line 1. 175######## 176use warnings; 177eval "sub foo (@\xAB) {}"; 178EXPECT 179Prototype after '@' for main::foo : @\x{ab} at (eval 1) line 1. 180Illegal character in prototype for main::foo : @\x{ab} at (eval 1) line 1. 181######## 182use utf8; 183use open qw( :utf8 :std ); 184use warnings; 185BEGIN { eval "sub foo (@\x{30cb}) {}"; } 186EXPECT 187Prototype after '@' for main::foo : @\x{30cb} at (eval 1) line 1. 188Illegal character in prototype for main::foo : @\x{30cb} at (eval 1) line 1. 189######## 190use warnings; 191sub f ([); 192sub f :prototype([) 193EXPECT 194Missing ']' in prototype for main::f : [ at - line 2. 195Missing ']' in prototype for main::f : [ at - line 3. 196######## 197use warnings; 198package bar { sub bar { eval q"sub foo ([)" } } 199bar::bar 200EXPECT 201Missing ']' in prototype for bar::foo : [ at (eval 1) line 1. 202######## 203# toke.c 204$a =~ m/$foo/eq; 205$a =~ s/$foo/fool/seq; 206 207EXPECT 208OPTION fatal 209Unknown regexp modifier "/e" at - line 2, near "=~ " 210Unknown regexp modifier "/q" at - line 2, near "=~ " 211Unknown regexp modifier "/q" at - line 3, near "=~ " 212Execution of - aborted due to compilation errors. 213######## 214# toke.c 215use utf8; 216use open qw( :utf8 :std ); 217$a =~ m/$foo/eネq; 218$a =~ s/$foo/fool/seネq; 219 220EXPECT 221OPTION fatal 222Unknown regexp modifier "/e" at - line 4, near "=~ " 223Unknown regexp modifier "/ネ" at - line 4, near "=~ " 224Unknown regexp modifier "/q" at - line 4, near "=~ " 225Unknown regexp modifier "/ネ" at - line 5, near "=~ " 226Unknown regexp modifier "/q" at - line 5, near "=~ " 227Execution of - aborted due to compilation errors. 228######## 229# toke.c 230use warnings 'syntax' ; 231s/(abc)/\1/; 232no warnings 'syntax' ; 233s/(abc)/\1/; 234EXPECT 235\1 better written as $1 at - line 3. 236######## 237# toke.c 238use warnings 'semicolon' ; 239$a = 1 240&time ; 241no warnings 'semicolon' ; 242$a = 1 243&time ; 244EXPECT 245Semicolon seems to be missing at - line 3. 246######## 247# toke.c 248use warnings 'syntax' ; 249my $a =+ 2 ; 250$a =- 2 ; 251$a =* 2 ; 252$a =% 2 ; 253$a =& 2 ; 254$a =. 2 ; 255$a =^ 2 ; 256$a =| 2 ; 257$a =< 2 ; 258$a =/ 2 ; 259EXPECT 260Reversed += operator at - line 3. 261Reversed -= operator at - line 4. 262Reversed *= operator at - line 5. 263Reversed %= operator at - line 6. 264Reversed &= operator at - line 7. 265Reversed .= operator at - line 8. 266Reversed ^= operator at - line 9. 267Reversed |= operator at - line 10. 268Reversed <= operator at - line 11. 269syntax error at - line 8, near "=." 270syntax error at - line 9, near "=^" 271syntax error at - line 10, near "=|" 272Unterminated <> operator at - line 11. 273######## 274# toke.c 275no warnings 'syntax' ; 276my $a =+ 2 ; 277$a =- 2 ; 278$a =* 2 ; 279$a =% 2 ; 280$a =& 2 ; 281$a =. 2 ; 282$a =^ 2 ; 283$a =| 2 ; 284$a =< 2 ; 285$a =/ 2 ; 286EXPECT 287syntax error at - line 8, near "=." 288syntax error at - line 9, near "=^" 289syntax error at - line 10, near "=|" 290Unterminated <> operator at - line 11. 291######## 292# toke.c 293use warnings 'syntax' ; 294my $a = $a[1,2] ; 295no warnings 'syntax' ; 296my $a = $a[1,2] ; 297EXPECT 298Multidimensional syntax $a[1,2] not supported at - line 3. 299######## 300# toke.c 301use warnings 'syntax' ; 302sub fred {} ; $SIG{TERM} = fred; 303no warnings 'syntax' ; 304$SIG{TERM} = fred; 305EXPECT 306You need to quote "fred" at - line 3. 307######## 308# toke.c 309use utf8; 310use open qw( :utf8 :std ); 311use warnings 'syntax' ; 312sub frèd {} ; $SIG{TERM} = frèd; 313no warnings 'syntax' ; 314$SIG{TERM} = frèd; 315EXPECT 316You need to quote "frèd" at - line 5. 317######## 318# toke.c 319use utf8; 320use open qw( :utf8 :std ); 321use warnings 'syntax' ; 322sub ふれど {} ; $SIG{TERM} = ふれど; 323no warnings 'syntax' ; 324$SIG{TERM} = ふれど; 325EXPECT 326You need to quote "ふれど" at - line 5. 327######## 328# toke.c 329use warnings 'syntax' ; 330$_ = "ab" ; 331s/(ab)/\1/e; 332s//\(2)/e; # should be exempt 333s/${\2}//; # same here 334()="${\2}"; # metoo 335no warnings 'syntax' ; 336$_ = "ab" ; 337s/(ab)/\1/e; 338EXPECT 339Can't use \1 to mean $1 in expression at - line 4. 340######## 341# toke.c 342use warnings 'reserved' ; 343$a = abc; 344$a = { def 345 346=> 1 }; 347no warnings 'reserved' ; 348$a = abc; 349EXPECT 350Unquoted string "abc" may clash with future reserved word at - line 3. 351######## 352# toke.c 353use warnings 'qw' ; 354@a = qw(a, b, c) ; 355no warnings 'qw' ; 356@a = qw(a, b, c) ; 357EXPECT 358Possible attempt to separate words with commas at - line 3. 359######## 360# toke.c 361use warnings 'qw' ; 362@a = qw(a b c # #) ; 363no warnings 'qw' ; 364@a = qw(a b c # #) ; 365EXPECT 366Possible attempt to put comments in qw() list at - line 3. 367######## 368# toke.c 369use warnings 'qw' ; 370@a = qw(a, b, c # #) ; 371no warnings 'qw' ; 372@a = qw(a, b, c # #) ; 373EXPECT 374Possible attempt to separate words with commas at - line 3. 375Possible attempt to put comments in qw() list at - line 3. 376######## 377# toke.c 378use warnings 'syntax' ; 379print (""); 380print ("") and $x = 1; 381print ("") or die; 382print ("") // die; 383print (1+2) * 3 if 0; # only this one should warn 384print (1+2) if 0; 385EXPECT 386print (...) interpreted as function at - line 7. 387######## 388# toke.c 389no warnings 'syntax' ; 390print ("") 391EXPECT 392 393######## 394# toke.c 395use warnings 'syntax' ; 396printf (""); 397printf ("") . ''; 398EXPECT 399printf (...) interpreted as function at - line 4. 400######## 401# toke.c 402no warnings 'syntax' ; 403printf ("") 404EXPECT 405 406######## 407# toke.c 408use warnings 'syntax' ; 409sort (""); 410sort ("") . ''; 411EXPECT 412sort (...) interpreted as function at - line 4. 413######## 414# toke.c 415no warnings 'syntax' ; 416sort ("") 417EXPECT 418 419######## 420use warnings 'syntax'; 421@foo::bar = 1..3; 422() = "$foo'bar"; 423() = "@foo'bar"; 424() = "$#foo'bar"; 425no warnings 'syntax' ; 426() = "$foo'bar"; 427() = "@foo'bar"; 428() = "$#foo'bar"; 429EXPECT 430Old package separator used in string at - line 3. 431 (Did you mean "$foo\'bar" instead?) 432Old package separator used in string at - line 4. 433 (Did you mean "@foo\'bar" instead?) 434Old package separator used in string at - line 5. 435 (Did you mean "$#foo\'bar" instead?) 436######## 437use warnings 'syntax'; use utf8; 438@fooл::barл = 1..3; 439() = "$fooл'barл"; 440() = "@fooл'barл"; 441() = "$#fooл'barл"; 442no warnings 'syntax' ; 443() = "$fooл'barл"; 444() = "@fooл'barл"; 445() = "$#fooл'barл"; 446EXPECT 447Old package separator used in string at - line 3. 448 (Did you mean "$fooл\'barл" instead?) 449Old package separator used in string at - line 4. 450 (Did you mean "@fooл\'barл" instead?) 451Old package separator used in string at - line 5. 452 (Did you mean "$#fooл\'barл" instead?) 453######## 454# toke.c 455use warnings 'ambiguous' ; 456$a = ${time[2]}; 457no warnings 'ambiguous' ; 458$a = ${time[2]}; 459EXPECT 460Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. 461######## 462# toke.c 463use warnings 'ambiguous' ; 464$a = ${time{2}}; 465EXPECT 466Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. 467######## 468# toke.c 469use warnings 'ambiguous' ; 470$a = ${ 471 472 time 473 {2} 474}; 475warn "after"; 476EXPECT 477Ambiguous use of ${time{...}} resolved to $time{...} at - line 5. 478after at - line 8. 479######## 480# toke.c 481use warnings 'ambiguous' ; 482$a = ${ 483 484time[2] 485 486}; 487$a = ${ 488 489time 490 [2] 491 492}; 493warn "after"; 494EXPECT 495Ambiguous use of ${time[...]} resolved to $time[...] at - line 5. 496Ambiguous use of ${time[...]} resolved to $time[...] at - line 10. 497after at - line 14. 498######## 499# toke.c 500no warnings 'ambiguous' ; 501$a = ${time{2}}; 502EXPECT 503 504######## 505# toke.c 506use warnings 'ambiguous' ; 507$a = ${time} ; 508$a = @{time} ; 509$a = $#{time} ; # This one is special cased in toke.c 510$a = %{time} ; 511$a = *{time} ; 512$a = defined &{time} ; # To avoid calling &::time 513no warnings 'ambiguous' ; 514$a = ${time} ; 515$a = @{time} ; 516$a = $#{time} ; # This one is special cased in toke.c 517$a = %{time} ; 518$a = *{time} ; 519$a = defined &{time} ; # To avoid calling &::time 520EXPECT 521Ambiguous use of ${time} resolved to $time at - line 3. 522Ambiguous use of @{time} resolved to @time at - line 4. 523Ambiguous use of @{time} resolved to @time at - line 5. 524Ambiguous use of %{time} resolved to %time at - line 6. 525Ambiguous use of *{time} resolved to *time at - line 7. 526Ambiguous use of &{time} resolved to &time at - line 8. 527######## 528# toke.c 529use warnings 'ambiguous' ; 530$a = ${ 531time 532} ; 533$a = @{ 534time 535} ; 536$a = $#{ 537time 538} ; 539$a = %{ 540time 541} ; 542$a = *{ 543time 544} ; 545$a = defined &{ 546time 547 548 549} ; 550warn "last"; 551EXPECT 552Ambiguous use of ${time} resolved to $time at - line 4. 553Ambiguous use of @{time} resolved to @time at - line 7. 554Ambiguous use of @{time} resolved to @time at - line 10. 555Ambiguous use of %{time} resolved to %time at - line 13. 556Ambiguous use of *{time} resolved to *time at - line 16. 557Ambiguous use of &{time} resolved to &time at - line 19. 558last at - line 23. 559######## 560# toke.c 561use warnings 'ambiguous' ; 562sub fred {} 563$a = ${fred} ; 564no warnings 'ambiguous' ; 565$a = ${fred} ; 566EXPECT 567Ambiguous use of ${fred} resolved to $fred at - line 4. 568######## 569# toke.c 570use warnings 'syntax' ; 571$a = _123; print "$a\n"; #( 3 string) 572$a = 1_23; print "$a\n"; 573$a = 12_3; print "$a\n"; 574$a = 123_; print "$a\n"; # 6 575$a = _+123; print "$a\n"; # 7 string) 576$a = +_123; print "$a\n"; #( 8 string) 577$a = +1_23; print "$a\n"; 578$a = +12_3; print "$a\n"; 579$a = +123_; print "$a\n"; # 11 580$a = _-123; print "$a\n"; #(12 string) 581$a = -_123; print "$a\n"; #(13 string) 582$a = -1_23; print "$a\n"; 583$a = -12_3; print "$a\n"; 584$a = -123_; print "$a\n"; # 16 585$a = 123._456; print "$a\n"; # 17 586$a = 123.4_56; print "$a\n"; 587$a = 123.45_6; print "$a\n"; 588$a = 123.456_; print "$a\n"; # 20 589$a = +123._456; print "$a\n"; # 21 590$a = +123.4_56; print "$a\n"; 591$a = +123.45_6; print "$a\n"; 592$a = +123.456_; print "$a\n"; # 24 593$a = -123._456; print "$a\n"; # 25 594$a = -123.4_56; print "$a\n"; 595$a = -123.45_6; print "$a\n"; 596$a = -123.456_; print "$a\n"; # 28 597$a = 123.456E_12; printf("%.0f\n", $a); # 29 598$a = 123.456E1_2; printf("%.0f\n", $a); 599$a = 123.456E12_; printf("%.0f\n", $a); # 31 600$a = 123.456E_+12; printf("%.0f\n", $a); # 32 601$a = 123.456E+_12; printf("%.0f\n", $a); # 33 602$a = 123.456E+1_2; printf("%.0f\n", $a); 603$a = 123.456E+12_; printf("%.0f\n", $a); # 35 604$a = 123.456E_-12; print "$a\n"; # 36 605$a = 123.456E-_12; print "$a\n"; # 37 606$a = 123.456E-1_2; print "$a\n"; 607$a = 123.456E-12_; print "$a\n"; # 39 608$a = 1__23; print "$a\n"; # 40 609$a = 12.3__4; print "$a\n"; # 41 610$a = 12.34e1__2; printf("%.0f\n", $a); # 42 611no warnings 'syntax' ; 612$a = _123; print "$a\n"; 613$a = 1_23; print "$a\n"; 614$a = 12_3; print "$a\n"; 615$a = 123_; print "$a\n"; 616$a = _+123; print "$a\n"; 617$a = +_123; print "$a\n"; 618$a = +1_23; print "$a\n"; 619$a = +12_3; print "$a\n"; 620$a = +123_; print "$a\n"; 621$a = _-123; print "$a\n"; 622$a = -_123; print "$a\n"; 623$a = -1_23; print "$a\n"; 624$a = -12_3; print "$a\n"; 625$a = -123_; print "$a\n"; 626$a = 123._456; print "$a\n"; 627$a = 123.4_56; print "$a\n"; 628$a = 123.45_6; print "$a\n"; 629$a = 123.456_; print "$a\n"; 630$a = +123._456; print "$a\n"; 631$a = +123.4_56; print "$a\n"; 632$a = +123.45_6; print "$a\n"; 633$a = +123.456_; print "$a\n"; 634$a = -123._456; print "$a\n"; 635$a = -123.4_56; print "$a\n"; 636$a = -123.45_6; print "$a\n"; 637$a = -123.456_; print "$a\n"; 638$a = 123.456E_12; printf("%.0f\n", $a); 639$a = 123.456E1_2; printf("%.0f\n", $a); 640$a = 123.456E12_; printf("%.0f\n", $a); 641$a = 123.456E_+12; printf("%.0f\n", $a); 642$a = 123.456E+_12; printf("%.0f\n", $a); 643$a = 123.456E+1_2; printf("%.0f\n", $a); 644$a = 123.456E+12_; printf("%.0f\n", $a); 645$a = 123.456E_-12; print "$a\n"; 646$a = 123.456E-_12; print "$a\n"; 647$a = 123.456E-1_2; print "$a\n"; 648$a = 123.456E-12_; print "$a\n"; 649$a = 1__23; print "$a\n"; 650$a = 12.3__4; print "$a\n"; 651$a = 12.34e1__2; printf("%.0f\n", $a); 652EXPECT 653OPTIONS regex 654Misplaced _ in number at - line 6. 655Misplaced _ in number at - line 11. 656Misplaced _ in number at - line 16. 657Misplaced _ in number at - line 17. 658Misplaced _ in number at - line 20. 659Misplaced _ in number at - line 21. 660Misplaced _ in number at - line 24. 661Misplaced _ in number at - line 25. 662Misplaced _ in number at - line 28. 663Misplaced _ in number at - line 29. 664Misplaced _ in number at - line 31. 665Misplaced _ in number at - line 32. 666Misplaced _ in number at - line 33. 667Misplaced _ in number at - line 35. 668Misplaced _ in number at - line 36. 669Misplaced _ in number at - line 37. 670Misplaced _ in number at - line 39. 671Misplaced _ in number at - line 40. 672Misplaced _ in number at - line 41. 673Misplaced _ in number at - line 42. 674_123 675123 676123 677123 678123 679_123 680123 681123 682123 683-123 684-_123 685-123 686-123 687-123 688123.456 689123.456 690123.456 691123.456 692123.456 693123.456 694123.456 695123.456 696-123.456 697-123.456 698-123.456 699-123.456 700123456000000000 701123456000000000 702123456000000000 703123456000000000 704123456000000000 705123456000000000 706123456000000000 7071.23456e-0?10 7081.23456e-0?10 7091.23456e-0?10 7101.23456e-0?10 711123 71212.34 71312340000000000 714_123 715123 716123 717123 718123 719_123 720123 721123 722123 723-123 724-_123 725-123 726-123 727-123 728123.456 729123.456 730123.456 731123.456 732123.456 733123.456 734123.456 735123.456 736-123.456 737-123.456 738-123.456 739-123.456 740123456000000000 741123456000000000 742123456000000000 743123456000000000 744123456000000000 745123456000000000 746123456000000000 7471.23456e-0?10 7481.23456e-0?10 7491.23456e-0?10 7501.23456e-0?10 751123 75212.34 75312340000000000 754######## 755# toke.c 756use warnings 'syntax'; 757$a = 1_; print "$a\n"; 758$a = 01_; print "$a\n"; 759$a = 0_; print "$a\n"; 760$a = 0x1_; print "$a\n"; 761$a = 0x_; print "$a\n"; 762$a = 1.2_; print "$a\n"; 763$a = 1._2; print "$a\n"; 764$a = 1._; print "$a\n"; 765EXPECT 766Misplaced _ in number at - line 3. 767Misplaced _ in number at - line 4. 768Misplaced _ in number at - line 5. 769Misplaced _ in number at - line 6. 770Misplaced _ in number at - line 7. 771Misplaced _ in number at - line 8. 772Misplaced _ in number at - line 9. 773Misplaced _ in number at - line 10. 7741 7751 7760 7771 7780 7791.2 7801.2 7811 782######## 783# toke.c 784use warnings 'bareword' ; 785#line 25 "bar" 786$a = FRED:: ; 787no warnings 'bareword' ; 788#line 25 "bar" 789$a = FRED:: ; 790EXPECT 791Bareword "FRED::" refers to nonexistent package at bar line 25. 792######## 793# toke.c 794use utf8; 795use open qw( :utf8 :std ); 796use warnings 'bareword' ; 797#line 25 "bar" 798$a = FRÈD:: ; 799no warnings 'bareword' ; 800#line 25 "bar" 801$a = FRÈD:: ; 802EXPECT 803Bareword "FRÈD::" refers to nonexistent package at bar line 25. 804######## 805# toke.c 806use utf8; 807use open qw( :utf8 :std ); 808use warnings 'bareword' ; 809#line 25 "bar" 810$a = ϞϞϞ:: ; 811no warnings 'bareword' ; 812#line 25 "bar" 813$a = ϞϞϞ:: ; 814EXPECT 815Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25. 816######## 817# toke.c 818use warnings 'ambiguous' ; 819sub time {} 820my $a = time() ; 821no warnings 'ambiguous' ; 822my $b = time() ; 823EXPECT 824Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. 825######## 826# toke.c 827use warnings ; 828eval <<'EOE'; 829# line 30 "foo" 830warn "yelp"; 831{ 832 $_ = " \x{123} " ; 833} 834EOE 835EXPECT 836yelp at foo line 30. 837######## 838# toke.c 839my $a = rand + 4 ; 840$a = rand *^H ; 841$a = rand $^H ; 842EXPECT 843Warning: Use of "rand" without parentheses is ambiguous at - line 2. 844######## 845# toke.c 846$^W = 0 ; 847my $a = rand + 4 ; 848{ 849 no warnings 'ambiguous' ; 850 $a = rand + 4 ; 851 use warnings 'ambiguous' ; 852 $a = rand + 4 ; 853} 854$a = rand + 4 ; 855EXPECT 856Warning: Use of "rand" without parentheses is ambiguous at - line 3. 857Warning: Use of "rand" without parentheses is ambiguous at - line 8. 858Warning: Use of "rand" without parentheses is ambiguous at - line 10. 859######## 860# [perl #97110] 861sub myrand(;$) { } 862sub whatever($) { } 863my $a = myrand + 4 ; 864my $b = whatever + 4 ; 865EXPECT 866Warning: Use of "myrand" without parentheses is ambiguous at - line 4. 867######## 868# toke.c 869use warnings "ambiguous"; 870print for keys %+; # should not warn 871EXPECT 872######## 873# toke.c [This does not warn any more.] 874sub fred {}; 875-fred ; 876sub hank : lvalue {$_} 877--hank; # This should *not* warn [perl #77240] 878EXPECT 879######## 880# toke.c [This does not warn any more.] 881$^W = 0 ; 882sub fred {} ; 883-fred ; 884{ 885 no warnings 'ambiguous' ; 886 -fred ; 887 use warnings 'ambiguous' ; 888 -fred ; 889} 890-fred ; 891EXPECT 892######## 893# toke.c [This does not warn any more.] 894use utf8; 895use open qw( :utf8 :std ); 896sub frèd {}; 897-frèd ; 898EXPECT 899######## 900# toke.c [This does not warn any more.] 901$^W = 0 ; 902use utf8; 903use open qw( :utf8 :std ); 904sub frèd {} ; 905-frèd ; 906{ 907 no warnings 'ambiguous' ; 908 -frèd ; 909 use warnings 'ambiguous' ; 910 -frèd ; 911} 912-frèd ; 913EXPECT 914######## 915# toke.c [This does not warn any more.] 916use utf8; 917use open qw( :utf8 :std ); 918sub ᒍᒘᒊ {}; 919-ᒍᒘᒊ ; 920EXPECT 921######## 922# toke.c [This does not warn any more.] 923$^W = 0 ; 924use utf8; 925use open qw( :utf8 :std ); 926sub ᒍᒘᒊ {} ; 927-ᒍᒘᒊ ; 928{ 929 no warnings 'ambiguous' ; 930 -ᒍᒘᒊ ; 931 use warnings 'ambiguous' ; 932 -ᒍᒘᒊ ; 933} 934-ᒍᒘᒊ ; 935EXPECT 936######## 937# toke.c 938open FOO || time; 939open local *FOO; # should be ok 940EXPECT 941Precedence problem: open FOO should be open(FOO) at - line 2. 942######## 943# toke.c 944use utf8; 945use open qw( :utf8 :std ); 946open FÒÒ || time; 947EXPECT 948Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4. 949######## 950# toke.c 951use utf8; 952use open qw( :utf8 :std ); 953open ᒍOO || time; 954EXPECT 955Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4. 956######## 957# toke.c (and [perl #16184]) 958open FOO => "<&0"; close FOO; 959EXPECT 960######## 961# toke.c 962$^W = 0 ; 963open FOO || time; 964{ 965 no warnings 'precedence' ; 966 open FOO || time; 967 use warnings 'precedence' ; 968 open FOO || time; 969} 970open FOO || time; 971open Foo::BAR; # this should not warn 972EXPECT 973Precedence problem: open FOO should be open(FOO) at - line 3. 974Precedence problem: open FOO should be open(FOO) at - line 8. 975Precedence problem: open FOO should be open(FOO) at - line 10. 976######## 977# toke.c 978$^W = 0 ; 979use utf8; 980use open qw( :utf8 :std ); 981open FÒÒ || time; 982{ 983 no warnings 'precedence' ; 984 open FÒÒ || time; 985 use warnings 'precedence' ; 986 open FÒÒ || time; 987} 988open FÒÒ || time; 989EXPECT 990Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5. 991Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10. 992Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12. 993######## 994# toke.c 995use utf8; 996use open qw( :utf8 :std ); 997$^W = 0 ; 998open ᒍÒÒ || time; 999{ 1000 no warnings 'precedence' ; 1001 open ᒍÒÒ || time; 1002 use warnings 'precedence' ; 1003 open ᒍÒÒ || time; 1004} 1005open ᒍÒÒ || time; 1006EXPECT 1007Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5. 1008Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10. 1009Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12. 1010######## 1011# toke.c 1012$^W = 0 ; 1013*foo *foo ; 1014{ 1015 no warnings 'ambiguous' ; 1016 *foo *foo ; 1017 use warnings 'ambiguous' ; 1018 *foo *foo ; 1019} 1020*foo *foo ; 1021# These should not warn [perl #117535]: 1022foo**foo ; 1023no warnings 'deprecated'; 1024sort $*foo ; 1025sort $ *foo ; 1026EXPECT 1027Operator or semicolon missing before *foo at - line 3. 1028Ambiguous use of * resolved as operator * at - line 3. 1029Operator or semicolon missing before *foo at - line 8. 1030Ambiguous use of * resolved as operator * at - line 8. 1031Operator or semicolon missing before *foo at - line 10. 1032Ambiguous use of * resolved as operator * at - line 10. 1033######## 1034# toke.c 1035$^W = 0 ; 1036%foo %foo ; 1037{ 1038 no warnings 'ambiguous' ; 1039 %foo %foo ; 1040 use warnings 'ambiguous' ; 1041 %foo %foo ; 1042} 1043%foo %foo ; 1044# This should not produce ambiguity warnings [perl #117535]: 1045sort $%foo ; 1046sort $ %foo ; 1047EXPECT 1048Operator or semicolon missing before %foo at - line 3. 1049Ambiguous use of % resolved as operator % at - line 3. 1050Operator or semicolon missing before %foo at - line 8. 1051Ambiguous use of % resolved as operator % at - line 8. 1052Operator or semicolon missing before %foo at - line 10. 1053Ambiguous use of % resolved as operator % at - line 10. 1054Bareword found where operator expected at - line 12, near "$%foo" 1055 (Missing operator before foo?) 1056Bareword found where operator expected at - line 13, near "$ %foo" 1057 (Missing operator before foo?) 1058Illegal modulus zero at - line 3. 1059######## 1060# toke.c 1061$^W = 0 ; 1062&foo &foo ; 1063{ 1064 no warnings 'ambiguous' ; 1065 &foo &foo ; 1066 use warnings 'ambiguous' ; 1067 &foo &foo ; 1068} 1069&foo &foo ; 1070# These should not warn produce ambiguity warnings [perl #76910]: 1071foo&&foo ; 1072sort $&foo ; 1073sort $ &foo ; 1074EXPECT 1075Operator or semicolon missing before &foo at - line 3. 1076Ambiguous use of & resolved as operator & at - line 3. 1077Operator or semicolon missing before &foo at - line 8. 1078Ambiguous use of & resolved as operator & at - line 8. 1079Operator or semicolon missing before &foo at - line 10. 1080Ambiguous use of & resolved as operator & at - line 10. 1081Bareword found where operator expected at - line 13, near "$&foo" 1082 (Missing operator before foo?) 1083Bareword found where operator expected at - line 14, near "$ &foo" 1084 (Missing operator before foo?) 1085Undefined subroutine &main::foo called at - line 3. 1086######## 1087# toke.c 1088use utf8; 1089use open qw( :utf8 :std ); 1090$^W = 0 ; 1091*foo *foo ; 1092{ 1093 no warnings 'ambiguous' ; 1094 *foo *foo ; 1095 use warnings 'ambiguous' ; 1096 *foo *foo ; 1097} 1098*foo *foo ; 1099EXPECT 1100Operator or semicolon missing before *foo at - line 5. 1101Ambiguous use of * resolved as operator * at - line 5. 1102Operator or semicolon missing before *foo at - line 10. 1103Ambiguous use of * resolved as operator * at - line 10. 1104Operator or semicolon missing before *foo at - line 12. 1105Ambiguous use of * resolved as operator * at - line 12. 1106######## 1107# toke.c 1108use warnings 'misc' ; 1109my $a = "\m" ; 1110no warnings 'misc' ; 1111$a = "\m" ; 1112EXPECT 1113Unrecognized escape \m passed through at - line 3. 1114######## 1115# toke.c 1116use warnings 'misc' ; 1117my $a = "abcd\E" ; 1118no warnings 'misc' ; 1119$a = "abcd\E" ; 1120EXPECT 1121Useless use of \E at - line 3. 1122######## 1123# toke.c 1124use feature 'postderef_qq'; 1125(\$_)->$*; 1126"$_->$*"; 1127(\$_)->$*; 1128"$_->$*"; 1129EXPECT 1130######## 1131# toke.c 1132use warnings 'portable' ; 1133my $a = 0b011111111111111111111111111111110 ; 1134 $a = 0b011111111111111111111111111111111 ; 1135 $a = 0b111111111111111111111111111111111 ; 1136 $a = 0x0fffffffe ; 1137 $a = 0x0ffffffff ; 1138 $a = 0x1ffffffff ; 1139 $a = 0037777777776 ; 1140 $a = 0037777777777 ; 1141 $a = 0047777777777 ; 1142no warnings 'portable' ; 1143 $a = 0b011111111111111111111111111111110 ; 1144 $a = 0b011111111111111111111111111111111 ; 1145 $a = 0b111111111111111111111111111111111 ; 1146 $a = 0x0fffffffe ; 1147 $a = 0x0ffffffff ; 1148 $a = 0x1ffffffff ; 1149 $a = 0037777777776 ; 1150 $a = 0037777777777 ; 1151 $a = 0047777777777 ; 1152EXPECT 1153Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. 1154Hexadecimal number > 0xffffffff non-portable at - line 8. 1155Octal number > 037777777777 non-portable at - line 11. 1156######## 1157# toke.c 1158use warnings 'overflow' ; 1159my $a = 0b011111111111111111111111111111110 ; 1160 $a = 0b011111111111111111111111111111111 ; 1161 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; 1162 $a = 0x0fffffffe ; 1163 $a = 0x0ffffffff ; 1164 $a = 0x10000000000000000 ; 1165 $a = 0037777777776 ; 1166 $a = 0037777777777 ; 1167 $a = 002000000000000000000000; 1168no warnings 'overflow' ; 1169 $a = 0b011111111111111111111111111111110 ; 1170 $a = 0b011111111111111111111111111111111 ; 1171 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; 1172 $a = 0x0fffffffe ; 1173 $a = 0x0ffffffff ; 1174 $a = 0x10000000000000000 ; 1175 $a = 0037777777776 ; 1176 $a = 0037777777777 ; 1177 $a = 002000000000000000000000; 1178EXPECT 1179Integer overflow in binary number at - line 5. 1180Integer overflow in hexadecimal number at - line 8. 1181Integer overflow in octal number at - line 11. 1182######## 1183# toke.c 1184BEGIN { $^C = 1; } 1185dump; 1186CORE::dump; 1187EXPECT 1188dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 3. 1189- syntax OK 1190######## 1191# toke.c 1192BEGIN { $^C = 1; } 1193no warnings 'deprecated'; 1194dump; 1195CORE::dump; 1196EXPECT 1197- syntax OK 1198######## 1199# toke.c 1200BEGIN { $^C = 1; } 1201no warnings 'deprecated'; 1202use warnings 'misc'; 1203dump; 1204CORE::dump; 1205EXPECT 1206dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 5. 1207- syntax OK 1208######## 1209# toke.c 1210use warnings 'misc'; 1211use subs qw/dump/; 1212sub dump { print "no warning for overridden dump\n"; } 1213dump; 1214EXPECT 1215no warning for overridden dump 1216######## 1217# toke.c 1218use warnings 'ambiguous'; 1219"@mjd_previously_unused_array"; 1220no warnings 'ambiguous'; 1221"@mjd_previously_unused_array2"; 1222EXPECT 1223Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. 1224######## 1225# toke.c 1226use utf8; 1227use open qw( :utf8 :std ); 1228use warnings 'ambiguous'; 1229"@mjd_previously_unused_àrray"; 1230no warnings 'ambiguous'; 1231"@mjd_previously_unused_àrray2"; 1232EXPECT 1233Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5. 1234######## 1235# toke.c 1236use utf8; 1237use open qw( :utf8 :std ); 1238use warnings 'ambiguous'; 1239"@mjd_previously_unused_ぁrrぁy"; 1240no warnings 'ambiguous'; 1241"@mjd_previously_unused_ぁrrぁy2"; 1242EXPECT 1243Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5. 1244######## 1245-w 1246# toke.c 1247$_ = "@DB::args"; 1248EXPECT 1249######## 1250# toke.c 1251# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com 1252use warnings 'regexp'; 1253"foo" =~ /foo/c; 1254"foo" =~ /foo/cg; 1255no warnings 'regexp'; 1256"foo" =~ /foo/c; 1257"foo" =~ /foo/cg; 1258EXPECT 1259Use of /c modifier is meaningless without /g at - line 4. 1260######## 1261# toke.c 1262# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com 1263use warnings 'regexp'; 1264$_ = "ab" ; 1265s/ab/ab/c; 1266s/ab/ab/cg; 1267no warnings 'regexp'; 1268s/ab/ab/c; 1269s/ab/ab/cg; 1270EXPECT 1271Use of /c modifier is meaningless in s/// at - line 5. 1272Use of /c modifier is meaningless in s/// at - line 6. 1273######## 1274-wa 1275# toke.c 1276# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings 1277print "@F\n"; 1278EXPECT 1279 1280######## 1281-w 1282# toke.c 1283# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings 1284print "@F\n"; 1285EXPECT 1286Possible unintended interpolation of @F in string at - line 4. 1287Name "main::F" used only once: possible typo at - line 4. 1288######## 1289-wa 1290# toke.c 1291# 20020414 mjd-perl-patch+@plover.com 1292EXPECT 1293 1294######## 1295# toke.c 1296# 20020414 mjd-perl-patch+@plover.com 1297# In 5.7.3, this emitted "Possible unintended interpolation" warnings 1298use warnings 'ambiguous'; 1299$s = "(@-)(@+)"; 1300EXPECT 1301 1302######## 1303# toke.c 1304# mandatory warning 1305eval q/if ($a) { } elseif ($b) { }/; 1306no warnings "syntax"; 1307eval q/if ($a) { } elseif ($b) { }/; 1308EXPECT 1309elseif should be elsif at (eval 1) line 1. 1310######## 1311# toke.c 1312# mandatory warning 1313eval q/5 6/; 1314no warnings "syntax"; 1315eval q/5 6/; 1316EXPECT 1317Number found where operator expected at (eval 1) line 1, near "5 6" 1318 (Missing operator before 6?) 1319######## 1320# toke.c 1321use warnings "syntax"; no warnings "deprecated"; 1322$_ = $a = 1; 1323$a !=~ /1/; 1324$a !=~ m#1#; 1325$a !=~/1/; 1326$a !=~ y/1//; 1327$a !=~ tr/1//; 1328$a !=~ s/1//; 1329$a != ~/1/; 1330no warnings "syntax"; 1331$a !=~ /1/; 1332$a !=~ m#1#; 1333$a !=~/1/; 1334$a !=~ y/1//; 1335$a !=~ tr/1//; 1336$a !=~ s/1//; 1337EXPECT 1338!=~ should be !~ at - line 4. 1339!=~ should be !~ at - line 5. 1340!=~ should be !~ at - line 6. 1341!=~ should be !~ at - line 7. 1342!=~ should be !~ at - line 8. 1343!=~ should be !~ at - line 9. 1344######## 1345# toke.c 1346use warnings "syntax"; 1347sub proto_after_array(@$); 1348sub proto_after_arref(\@$); 1349sub proto_after_arref2(\[@$]); 1350sub proto_after_arref3(\[@$]_); 1351sub proto_after_hash(%$); 1352sub proto_after_hashref(\%$); 1353sub proto_after_hashref2(\[%$]); 1354sub underscore_last_pos($_); 1355sub underscore2($_;$); 1356sub underscore_fail($_$); sub underscore_fail2 : prototype($_$); 1357sub underscore_after_at(@_); 1358our sub hour (@$); 1359my sub migh (@$); 1360use feature 'state'; 1361state sub estate (@$); 1362package other; 1363sub hour (@$); 1364sub migh (@$); 1365sub estate (@$); 1366no warnings "syntax"; 1367sub proto_after_array(@$); 1368sub proto_after_hash(%$); 1369sub underscore_fail($_$); 1370EXPECT 1371Prototype after '@' for main::proto_after_array : @$ at - line 3. 1372Prototype after '%' for main::proto_after_hash : %$ at - line 7. 1373Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12. 1374Illegal character after '_' in prototype for main::underscore_fail2 : $_$ at - line 12. 1375Prototype after '@' for main::underscore_after_at : @_ at - line 13. 1376Prototype after '@' for hour : @$ at - line 14. 1377Prototype after '@' for migh : @$ at - line 15. 1378Prototype after '@' for estate : @$ at - line 17. 1379Prototype after '@' for hour : @$ at - line 19. 1380Prototype after '@' for migh : @$ at - line 20. 1381Prototype after '@' for estate : @$ at - line 21. 1382######## 1383# toke.c 1384use warnings "ambiguous"; 1385"foo\nn" =~ /^foo$\n/; 1386"foo\nn" =~ /^foo${\}n/; 1387my $foo = qr/^foo$\n/; 1388my $bar = qr/^foo${\}n/; 1389no warnings "ambiguous"; 1390"foo\nn" =~ /^foo$\n/; 1391"foo\nn" =~ /^foo${\}n/; 1392my $foo = qr/^foo$\n/; 1393my $bar = qr/^foo${\}n/; 1394EXPECT 1395Possible unintended interpolation of $\ in regex at - line 3. 1396Possible unintended interpolation of $\ in regex at - line 5. 1397######## 1398# toke.c 1399use warnings 'syntax' ; 1400my $a = "\o"; 1401my $a = "\o{"; 1402my $a = "\o{}"; 1403no warnings 'syntax' ; 1404my $a = "\o"; 1405my $a = "\o{"; 1406my $a = "\o{}"; 1407EXPECT 1408Missing braces on \o{} at - line 3, within string 1409Missing right brace on \o{ at - line 4, within string 1410Number with no digits at - line 5, within string 1411BEGIN not safe after errors--compilation aborted at - line 6. 1412######## 1413# toke.c 1414use warnings 'digit' ; 1415my $a = "\o{1238456}"; 1416no warnings 'digit' ; 1417my $a = "\o{1238456}"; 1418EXPECT 1419Non-octal character '8'. Resolved as "\o{123}" at - line 3. 1420######## 1421# toke.c 1422use warnings; 1423print ref ? "yes\n" : "no\n" foreach [], ''; # ? is unambiguosly an operator 1424EXPECT 1425yes 1426no 1427######## 1428# toke .c 1429use warnings; 1430$a =~ ?rand?; # ? is not a regex match 1431EXPECT 1432syntax error at - line 3, near "=~ ?" 1433Execution of - aborted due to compilation errors. 1434######## 1435# toke.c 1436BEGIN { 1437 if (ord('A') == 193) { 1438 print "SKIPPED\n# result varies depending on which ebcdic platform"; 1439 exit 0; 1440 } 1441} 1442use warnings; 1443$a = "\c,"; 1444$a = "\c`"; 1445no warnings 'syntax'; 1446$a = "\c,"; 1447$a = "\c`"; 1448EXPECT 1449"\c," is more clearly written simply as "l" at - line 9. 1450"\c`" is more clearly written simply as "\ " at - line 10. 1451######## 1452# toke.c 1453BEGIN { 1454 if (ord('A') == 193) { 1455 print "SKIPPED\n# test is ASCII-specific"; 1456 exit 0; 1457 } 1458} 1459use warnings; 1460my $a = "\c{ack}"; 1461EXPECT 1462OPTION fatal 1463Use ";" instead of "\c{" at - line 9. 1464######## 1465# toke.c 1466BEGIN { 1467 if (ord('A') == 65) { 1468 print "SKIPPED\n# test is EBCDIC-specific"; 1469 exit 0; 1470 } 1471} 1472use warnings; 1473my $a = "\c{ack}"; 1474EXPECT 1475OPTION fatal 1476Sequence "\c{" invalid at - line 9. 1477######## 1478# toke.c 1479my $a = "\câ"; 1480EXPECT 1481OPTION fatal 1482Character following "\c" must be printable ASCII at - line 2. 1483######## 1484# toke.c 1485use warnings 'syntax' ; 1486my $a = qr/foo/du; 1487$a = qr/foo/lai; 1488$a = qr/foo/lil; 1489$a = qr/foo/aia; 1490$a = qr/foo/aaia; 1491no warnings 'syntax' ; 1492my $a = qr/foo/du; 1493EXPECT 1494Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= " 1495Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= " 1496Regexp modifier "/l" may not appear twice at - line 5, near "= " 1497Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= " 1498BEGIN not safe after errors--compilation aborted at - line 8. 1499######## 1500# toke.c 1501# [perl #4362] 1502eval "print q\xabfoo"; 1503print "ok\n" if 1504 $@ =~ /Can't find string terminator "\xab" anywhere before EOF/; 1505EXPECT 1506ok 1507######## 1508# toke.c 1509use utf8; 1510use open qw( :utf8 :std ); 1511use warnings 'ambiguous' ; 1512sub frèd {} 1513$a = ${frèd} ; 1514no warnings 'ambiguous' ; 1515$a = ${frèd} ; 1516EXPECT 1517Ambiguous use of ${frèd} resolved to $frèd at - line 6. 1518######## 1519# toke.c 1520use utf8; 1521use open qw( :utf8 :std ); 1522use warnings 'ambiguous' ; 1523sub f렏 {} 1524$a = ${f렏} ; 1525no warnings 'ambiguous' ; 1526$a = ${f렏} ; 1527EXPECT 1528Ambiguous use of ${f렏} resolved to $f렏 at - line 6. 1529######## 1530# toke.c 1531use utf8; 1532use open qw( :utf8 :std ); 1533use warnings; 1534CORE::렏; 1535EXPECT 1536CORE::렏 is not a keyword at - line 5. 1537######## 1538# toke.c 1539# [perl #16249] 1540print ''; 1541eval this_method_is_fake (); 1542EXPECT 1543Undefined subroutine &main::this_method_is_fake called at - line 4. 1544######## 1545# toke.c 1546# [perl #107002] Erroneous ambiguity warnings 1547sub { # do not actually call require 1548 require a::b . 1; # These used to produce erroneous 1549 require a::b + 1; # ambiguity warnings. 1550} 1551EXPECT 1552######## 1553# toke.c 1554# [perl #113094], [perl #119101], since reverted so no warnings generated 1555use warnings; 1556print "aa" =~ m{^a\{1,2\}$}, "A\n"; 1557print "aa" =~ m{^a\x\{61\}$}, "B\n"; 1558print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "C\n"; 1559print "a\\o" =~ m{^a\\\x\{6F\}$}, "D\n"; 1560print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "E\n"; 1561print "a\\\\o" =~ m{^a\\\\\x\{6F\}$}, "F\n"; 1562print "aa" =~ m{^a{1,2}$}, "G\n"; 1563print "aq" =~ m[^a\[a-z\]$], "H\n"; 1564print "aq" =~ m(^a\(q\)$), "I\n"; 1565EXPECT 1566Illegal hexadecimal digit '\' ignored at - line 5. 1567Illegal hexadecimal digit '\' ignored at - line 7. 1568Illegal hexadecimal digit '\' ignored at - line 9. 1569A 1570B 15711C 1572D 15731E 1574F 15751G 1576H 1577I 1578######## 1579# toke.c 1580#[perl #119123] disallow literal control character variables 1581*{ 1582 Foo 1583}; # shouldn't warn on {\n, even though \n is a control character 1584EXPECT 1585######## 1586# toke.c 1587# [perl #120288] -X at start of line gave spurious warning, where X is not 1588# a filetest operator 1589-a; 1590;-a; 1591EXPECT 1592######## 1593# toke.c 1594# [perl #124113] Compile-time warning with UTF8 variable in array index 1595use warnings; 1596use utf8; 1597my $ = 0; 1598my @array = (0); 1599my $v = $array[ 0 + $ ]; 1600 $v = $array[ $ + 0 ]; 1601EXPECT 1602######## 1603# toke.c 1604# Allow Unicode here doc boundaries 1605use warnings; 1606use utf8; 1607my $v = <<EnFraçais; 1608Comme ca! 1609EnFraçais 1610print $v; 1611EXPECT 1612Comme ca! 1613######## 1614# toke.c 1615# Fix 'Use of "..." without parentheses is ambiguous' warning for 1616# Unicode function names. If not under PERL_UNICODE, this will generate 1617# a "Wide character" warning 1618use utf8; 1619use warnings; 1620sub (;$) { return 0; } 1621my $v = - 5; 1622EXPECT 1623OPTION regex 1624(Wide character.*\n)?Warning: Use of "" without parentheses is ambiguous 1625######## 1626# RT #4346 Case 1: Warnings for print (...) 1627# TODO RT #4346: Warnings for print(...) are inconsistent 1628use warnings; 1629print ("((\n"); 1630print (">>\n"); 1631EXPECT 1632print (...) interpreted as function at - line 3. 1633print (...) interpreted as function at - line 4. 1634(( 1635>> 1636######## 1637# RT #4346 Case 2: Warnings for print (...) 1638use warnings; 1639print ("((\n"); 1640print (">>\n") 1641EXPECT 1642print (...) interpreted as function at - line 3. 1643print (...) interpreted as function at - line 4. 1644(( 1645>> 1646######## 1647# RT #4346 Case 3: Warnings for print (...) 1648# TODO RT #4346: Warnings for print(...) are inconsistent 1649use warnings; 1650print (">>\n"); 1651print ("((\n"); 1652EXPECT 1653print (...) interpreted as function at - line 3. 1654print (...) interpreted as function at - line 4. 1655>> 1656(( 1657######## 1658# RT #4346 Case 4: Warnings for print (...) 1659# TODO RT #4346: Warnings for print(...) are inconsistent 1660use warnings; 1661print (")\n"); 1662print ("))\n"); 1663EXPECT 1664print (...) interpreted as function at - line 3. 1665print (...) interpreted as function at - line 4. 1666) 1667)) 1668######## 1669# NAME Non-grapheme delimiters 1670BEGIN{ 1671 if (ord('A') == 193) { 1672 print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings."; 1673 exit 0; 1674 } 1675} 1676use utf8; 1677my $a = qr ̂foobar̂; 1678EXPECT 1679Use of unassigned code point or non-standalone grapheme for a delimiter will be a fatal error starting in Perl 5.30 at - line 8. 1680######## 1681# NAME [perl #130567] Assertion failure 1682BEGIN { 1683 if (ord('A') != 65) { 1684 print "SKIPPED\n# test is ASCII-specific"; 1685 exit 0; 1686 } 1687} 1688no warnings "uninitialized"; 1689$_= ""; 1690s//\3000/; 1691s//"\x{180};;s\221(*$@$`\241\275";/gee; 1692s//"s\221\302\302\302\302\302\302\302$@\241\275";/gee; 1693EXPECT 1694######## 1695# NAME [perl #130666] Assertion failure 1696no warnings "uninitialized"; 1697BEGIN{$^H=-1};my $l; s$0[$l] 1698EXPECT 1699######## 1700# NAME [perl #129036] Assertion failure 1701BEGIN{$0="";$^H=hex join""=>A00000}p? 1702EXPECT 1703OPTION fatal 1704syntax error at - line 1, at EOF 1705Execution of - aborted due to compilation errors. 1706######## 1707# NAME [perl #130655] 1708use utf8; 1709qw∘foo ∞ ♥ bar∘ 1710EXPECT 1711