This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change error wording for \o{}
[perl5.git] / t / lib / warnings / toke
index 2214005..faaf5bc 100644 (file)
@@ -2,10 +2,11 @@ toke.c        AOK
 
     we seem to have lost a few ambiguous warnings!!
 
-               $a = <<;
-               Use of comma-less variable list is deprecated 
-               (called 3 times via depcom)
+     Prototype after '@' for main::foo
+       sub foo (@$)
+
+     Illegal character in prototype for main::foo
+       sub foo (x)
 
      \1 better written as $1 
        use warnings 'syntax' ;
@@ -35,10 +36,6 @@ toke.c       AOK
      You need to quote \"%s\"" 
        sub fred {} ; $SIG{TERM} = fred;
 
-     Scalar value %.*s better written as $%.*s" 
-       @a[3] = 2;
-       @a{3} = 2;
-
      Can't use \\%c to mean $%c in expression 
        $_ = "ab" ; s/(ab)/\1/e;
 
@@ -57,6 +54,11 @@ toke.c       AOK
        printf ("")
        sort ("")
 
+     Old package separator used in string
+       "$foo'bar"
+       "@foo'bar"
+       "$#foo'bar"
+
      Ambiguous use of %c{%s%s} resolved to %c%s%s 
        $a = ${time[2]}
        $a = ${time{2}}
@@ -83,6 +85,8 @@ toke.c        AOK
     Useless use of \\E.
         $a = "abcd\E" ;
 
+    Postfix dereference is experimental
+
     %s number > %s non-portable
         my $a =  0b011111111111111111111111111111110 ;
         $a =  0b011111111111111111111111111111111 ;
@@ -105,8 +109,6 @@ toke.c      AOK
         $a =  0037777777777 ;
         $a =  0047777777777 ;
 
-    dump() better written as CORE::dump()
-
     Use of /c modifier is meaningless without /g     
 
     Use of /c modifier is meaningless in s///
@@ -127,35 +129,100 @@ toke.c   AOK
         *foo *foo
 
 __END__
-# toke.c 
-format STDOUT =
-@<<<  @|||  @>>>  @>>>
-$a    $b    "abc" 'def'
-.
-no warnings 'deprecated' ;
-format STDOUT =
-@<<<  @|||  @>>>  @>>>
-$a    $b    "abc" 'def'
-.
-EXPECT
-Use of comma-less variable list is deprecated at - line 4.
-Use of comma-less variable list is deprecated at - line 4.
-Use of comma-less variable list is deprecated at - line 4.
-########
-# toke.c
-$a =~ m/$foo/sand $bar;
-$a =~ s/$foo/fool/sand $bar;
-$a = <<;
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+eval "sub fòò (@\$\0) {}";
+EXPECT
+Prototype after '@' for main::fòò : @$\0 at (eval 1) line 1.
+Illegal character in prototype for main::fòò : @$\0 at (eval 1) line 1.
+########
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+eval "sub foo (@\0) {}";
+eval "sub foo2 :prototype(@\0) {}";
+EXPECT
+Prototype after '@' for main::foo : @\0 at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.
+Prototype after '@' for main::foo2 : @\x{0} at (eval 2) line 1.
+Illegal character in prototype for main::foo2 : @\x{0} at (eval 2) line 1.
+########
+BEGIN {
+    if (ord('A') == 193) {
+        print "SKIPPED\n# Different results on EBCDIC";
+        exit 0;
+    }
+}
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { $::{"foo"} = "\@\$\0L\351on" }
+BEGIN { eval "sub foo (@\$\0L\x{c3}\x{a9}on) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @$\x{0}L... at (eval 1) line 1.
+Illegal character in prototype for main::foo : @$\x{0}L... at (eval 1) line 1.
+########
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { eval "sub foo (@\0) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @\0 at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.
+########
+use warnings;
+eval "sub foo (@\xAB) {}";
+EXPECT
+Prototype after '@' for main::foo : @\x{ab} at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\x{ab} at (eval 1) line 1.
+########
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { eval "sub foo (@\x{30cb}) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @\x{30cb} at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\x{30cb} at (eval 1) line 1.
+########
+use warnings;
+sub f ([);
+sub f :prototype([)
+EXPECT
+Missing ']' in prototype for main::f : [ at - line 2.
+Missing ']' in prototype for main::f : [ at - line 3.
+########
+use warnings;
+package bar { sub bar { eval q"sub foo ([)" } }
+bar::bar
+EXPECT
+Missing ']' in prototype for bar::foo : [ at (eval 1) line 1.
+########
+# toke.c
+$a =~ m/$foo/eq;
+$a =~ s/$foo/fool/seq;
 
-no warnings 'deprecated' ;
-$a =~ m/$foo/sand $bar;
-$a =~ s/$foo/fool/sand $bar;
-$a = <<;
+EXPECT
+OPTION fatal
+Unknown regexp modifier "/e" at - line 2, near "=~ "
+Unknown regexp modifier "/q" at - line 2, near "=~ "
+Unknown regexp modifier "/q" at - line 3, near "=~ "
+Execution of - aborted due to compilation errors.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+$a =~ m/$foo/eネq;
+$a =~ s/$foo/fool/seネq;
 
 EXPECT
-Having no space between pattern and following word is deprecated at - line 2.
-Having no space between pattern and following word is deprecated at - line 3.
-Use of bare << to mean <<"" is deprecated at - line 4.
+OPTION fatal
+Unknown regexp modifier "/e" at - line 4, near "=~ "
+Unknown regexp modifier "/ネ" at - line 4, near "=~ "
+Unknown regexp modifier "/q" at - line 4, near "=~ "
+Unknown regexp modifier "/ネ" at - line 5, near "=~ "
+Unknown regexp modifier "/q" at - line 5, near "=~ "
+Execution of - aborted due to compilation errors.
 ########
 # toke.c
 use warnings 'syntax' ;
@@ -258,19 +325,11 @@ You need to quote "ふれど" at - line 5.
 ########
 # toke.c
 use warnings 'syntax' ;
-@a[3] = 2;
-@a{3} = 2;
-no warnings 'syntax' ;
-@a[3] = 2;
-@a{3} = 2;
-EXPECT
-Scalar value @a[3] better written as $a[3] at - line 3.
-Scalar value @a{3} better written as $a{3} at - line 4.
-########
-# toke.c
-use warnings 'syntax' ;
 $_ = "ab" ; 
 s/(ab)/\1/e;
+s//\(2)/e; # should be exempt
+s/${\2}//; # same here
+()="${\2}"; # metoo
 no warnings 'syntax' ;
 $_ = "ab" ; 
 s/(ab)/\1/e;
@@ -356,6 +415,40 @@ sort ("")
 EXPECT
 
 ########
+use warnings 'syntax';
+@foo::bar = 1..3;
+() = "$foo'bar";
+() = "@foo'bar";
+() = "$#foo'bar";
+no warnings 'syntax' ;
+() = "$foo'bar";
+() = "@foo'bar";
+() = "$#foo'bar";
+EXPECT
+Old package separator used in string at - line 3.
+       (Did you mean "$foo\'bar" instead?)
+Old package separator used in string at - line 4.
+       (Did you mean "@foo\'bar" instead?)
+Old package separator used in string at - line 5.
+       (Did you mean "$#foo\'bar" instead?)
+########
+use warnings 'syntax'; use utf8;
+@fooл::barл = 1..3;
+() = "$fooл'barл";
+() = "@fooл'barл";
+() = "$#fooл'barл";
+no warnings 'syntax' ;
+() = "$fooл'barл";
+() = "@fooл'barл";
+() = "$#fooл'barл";
+EXPECT
+Old package separator used in string at - line 3.
+       (Did you mean "$fooл\'barл" instead?)
+Old package separator used in string at - line 4.
+       (Did you mean "@fooл\'barл" instead?)
+Old package separator used in string at - line 5.
+       (Did you mean "$#fooл\'barл" instead?)
+########
 # toke.c
 use warnings 'ambiguous' ;
 $a = ${time[2]};
@@ -371,6 +464,37 @@ EXPECT
 Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
 ########
 # toke.c
+use warnings 'ambiguous' ;
+$a = ${
+
+    time
+        {2}
+};
+warn "after";
+EXPECT
+Ambiguous use of ${time{...}} resolved to $time{...} at - line 5.
+after at - line 8.
+########
+# toke.c
+use warnings 'ambiguous' ;
+$a = ${
+
+time[2]
+
+};
+$a = ${
+
+time    
+   [2]
+
+};
+warn "after";
+EXPECT
+Ambiguous use of ${time[...]} resolved to $time[...] at - line 5.
+Ambiguous use of ${time[...]} resolved to $time[...] at - line 10.
+after at - line 14.
+########
+# toke.c
 no warnings 'ambiguous' ;
 $a = ${time{2}};
 EXPECT
@@ -379,10 +503,57 @@ EXPECT
 # toke.c
 use warnings 'ambiguous' ;
 $a = ${time} ;
+$a = @{time} ;
+$a = $#{time} ; # This one is special cased in toke.c
+$a = %{time} ;
+$a = *{time} ;
+$a = defined &{time} ; # To avoid calling &::time
 no warnings 'ambiguous' ;
 $a = ${time} ;
+$a = @{time} ;
+$a = $#{time} ; # This one is special cased in toke.c
+$a = %{time} ;
+$a = *{time} ;
+$a = defined &{time} ; # To avoid calling &::time
 EXPECT
 Ambiguous use of ${time} resolved to $time at - line 3.
+Ambiguous use of @{time} resolved to @time at - line 4.
+Ambiguous use of @{time} resolved to @time at - line 5.
+Ambiguous use of %{time} resolved to %time at - line 6.
+Ambiguous use of *{time} resolved to *time at - line 7.
+Ambiguous use of &{time} resolved to &time at - line 8.
+########
+# toke.c
+use warnings 'ambiguous' ;
+$a = ${
+time
+} ;
+$a = @{
+time
+} ;
+$a = $#{
+time
+} ;
+$a = %{
+time
+} ;
+$a = *{
+time
+} ;
+$a = defined &{
+time
+
+
+} ;
+warn "last";
+EXPECT
+Ambiguous use of ${time} resolved to $time at - line 4.
+Ambiguous use of @{time} resolved to @time at - line 7.
+Ambiguous use of @{time} resolved to @time at - line 10.
+Ambiguous use of %{time} resolved to %time at - line 13.
+Ambiguous use of *{time} resolved to *time at - line 16.
+Ambiguous use of &{time} resolved to &time at - line 19.
+last at - line 23.
 ########
 # toke.c
 use warnings 'ambiguous' ;
@@ -580,6 +751,34 @@ _123
 12340000000000
 ########
 # toke.c
+use warnings 'syntax';
+$a = 1_; print "$a\n";
+$a = 01_; print "$a\n";
+$a = 0_; print "$a\n";
+$a = 0x1_; print "$a\n";
+$a = 0x_; print "$a\n";
+$a = 1.2_; print "$a\n";
+$a = 1._2; print "$a\n";
+$a = 1._; print "$a\n";
+EXPECT
+Misplaced _ in number at - line 3.
+Misplaced _ in number at - line 4.
+Misplaced _ in number at - line 5.
+Misplaced _ in number at - line 6.
+Misplaced _ in number at - line 7.
+Misplaced _ in number at - line 8.
+Misplaced _ in number at - line 9.
+Misplaced _ in number at - line 10.
+1
+1
+0
+1
+0
+1.2
+1.2
+1
+########
+# toke.c
 use warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
@@ -590,6 +789,30 @@ EXPECT
 Bareword "FRED::" refers to nonexistent package at bar line 25.
 ########
 # toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'bareword' ;
+#line 25 "bar"
+$a = FRÈD:: ;
+no warnings 'bareword' ;
+#line 25 "bar"
+$a = FRÈD:: ;
+EXPECT
+Bareword "FRÈD::" refers to nonexistent package at bar line 25.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'bareword' ;
+#line 25 "bar"
+$a = ϞϞϞ:: ;
+no warnings 'bareword' ;
+#line 25 "bar"
+$a = ϞϞϞ:: ;
+EXPECT
+Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25.
+########
+# toke.c
 use warnings 'ambiguous' ;
 sub time {}
 my $a = time() ;
@@ -612,6 +835,8 @@ yelp at foo line 30.
 ########
 # toke.c
 my $a = rand + 4 ;
+$a = rand *^H ;
+$a = rand $^H ;
 EXPECT
 Warning: Use of "rand" without parentheses is ambiguous at - line 2.
 ########
@@ -643,13 +868,14 @@ use warnings "ambiguous";
 print for keys %+; # should not warn
 EXPECT
 ########
-# toke.c
+# toke.c [This does not warn any more.]
 sub fred {};
 -fred ;
+sub hank : lvalue {$_}
+--hank; # This should *not* warn [perl #77240]
 EXPECT
-Ambiguous use of -fred resolved as -&fred() at - line 3.
 ########
-# toke.c
+# toke.c [This does not warn any more.]
 $^W = 0 ;
 sub fred {} ;
 -fred ;
@@ -661,9 +887,50 @@ sub fred {} ;
 }
 -fred ;
 EXPECT
-Ambiguous use of -fred resolved as -&fred() at - line 4.
-Ambiguous use of -fred resolved as -&fred() at - line 9.
-Ambiguous use of -fred resolved as -&fred() at - line 11.
+########
+# toke.c [This does not warn any more.]
+use utf8;
+use open qw( :utf8 :std );
+sub frèd {};
+-frèd ;
+EXPECT
+########
+# toke.c [This does not warn any more.]
+$^W = 0 ;
+use utf8;
+use open qw( :utf8 :std );
+sub frèd {} ;
+-frèd ;
+{
+    no warnings 'ambiguous' ;
+    -frèd ;
+    use warnings 'ambiguous' ;
+    -frèd ;
+}
+-frèd ;
+EXPECT
+########
+# toke.c [This does not warn any more.]
+use utf8;
+use open qw( :utf8 :std );
+sub ᒍᒘᒊ {};
+-ᒍᒘᒊ ;
+EXPECT
+########
+# toke.c [This does not warn any more.]
+$^W = 0 ;
+use utf8;
+use open qw( :utf8 :std );
+sub ᒍᒘᒊ {} ;
+-ᒍᒘᒊ ;
+{
+    no warnings 'ambiguous' ;
+    -ᒍᒘᒊ ;
+    use warnings 'ambiguous' ;
+    -ᒍᒘᒊ ;
+}
+-ᒍᒘᒊ ;
+EXPECT
 ########
 # toke.c
 open FOO || time;
@@ -671,6 +938,20 @@ open local *FOO; # should be ok
 EXPECT
 Precedence problem: open FOO should be open(FOO) at - line 2.
 ########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+open FÒÒ || time;
+EXPECT
+Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+open ᒍOO || time;
+EXPECT
+Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4.
+########
 # toke.c (and [perl #16184])
 open FOO => "<&0"; close FOO;
 EXPECT
@@ -693,6 +974,40 @@ Precedence problem: open FOO should be open(FOO) at - line 10.
 ########
 # toke.c
 $^W = 0 ;
+use utf8;
+use open qw( :utf8 :std );
+open FÒÒ || time;
+{
+    no warnings 'precedence' ;
+    open FÒÒ || time;
+    use warnings 'precedence' ;
+    open FÒÒ || time;
+}
+open FÒÒ || time;
+EXPECT
+Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5.
+Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10.
+Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+$^W = 0 ;
+open ᒍÒÒ || time;
+{
+    no warnings 'precedence' ;
+    open ᒍÒÒ || time;
+    use warnings 'precedence' ;
+    open ᒍÒÒ || time;
+}
+open ᒍÒÒ || time;
+EXPECT
+Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5.
+Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10.
+Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12.
+########
+# toke.c
+$^W = 0 ;
 *foo *foo ;
 {
     no warnings 'ambiguous' ;
@@ -701,6 +1016,11 @@ $^W = 0 ;
     *foo *foo ;
 }
 *foo *foo ;
+# These should not warn [perl #117535]:
+foo**foo ;
+no warnings 'deprecated';
+sort $*foo ;
+sort $ *foo ;
 EXPECT
 Operator or semicolon missing before *foo at - line 3.
 Ambiguous use of * resolved as operator * at - line 3.
@@ -708,6 +1028,80 @@ Operator or semicolon missing before *foo at - line 8.
 Ambiguous use of * resolved as operator * at - line 8.
 Operator or semicolon missing before *foo at - line 10.
 Ambiguous use of * resolved as operator * at - line 10.
+$* is no longer supported as of Perl 5.30 at - line 14.
+########
+# toke.c
+$^W = 0 ;
+%foo %foo ;
+{
+    no warnings 'ambiguous' ;
+    %foo %foo ;
+    use warnings 'ambiguous' ;
+    %foo %foo ;
+}
+%foo %foo ;
+# This should not produce ambiguity warnings [perl #117535]:
+sort $%foo ;
+sort $ %foo ;
+EXPECT
+Operator or semicolon missing before %foo at - line 3.
+Ambiguous use of % resolved as operator % at - line 3.
+Operator or semicolon missing before %foo at - line 8.
+Ambiguous use of % resolved as operator % at - line 8.
+Operator or semicolon missing before %foo at - line 10.
+Ambiguous use of % resolved as operator % at - line 10.
+Bareword found where operator expected at - line 12, near "$%foo"
+       (Missing operator before foo?)
+Bareword found where operator expected at - line 13, near "$ %foo"
+       (Missing operator before foo?)
+Illegal modulus zero at - line 3.
+########
+# toke.c
+$^W = 0 ;
+&foo &foo ;
+{
+    no warnings 'ambiguous' ;
+    &foo &foo ;
+    use warnings 'ambiguous' ;
+    &foo &foo ;
+}
+&foo &foo ;
+# These should not warn produce ambiguity warnings [perl #76910]:
+foo&&foo ;
+sort $&foo ;
+sort $ &foo ;
+EXPECT
+Operator or semicolon missing before &foo at - line 3.
+Ambiguous use of & resolved as operator & at - line 3.
+Operator or semicolon missing before &foo at - line 8.
+Ambiguous use of & resolved as operator & at - line 8.
+Operator or semicolon missing before &foo at - line 10.
+Ambiguous use of & resolved as operator & at - line 10.
+Bareword found where operator expected at - line 13, near "$&foo"
+       (Missing operator before foo?)
+Bareword found where operator expected at - line 14, near "$ &foo"
+       (Missing operator before foo?)
+Undefined subroutine &main::foo called at - line 3.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+$^W = 0 ;
+*foo *foo ;
+{
+    no warnings 'ambiguous' ;
+    *foo *foo ;
+    use warnings 'ambiguous' ;
+    *foo *foo ;
+}
+*foo *foo ;
+EXPECT
+Operator or semicolon missing before *foo at - line 5.
+Ambiguous use of * resolved as operator * at - line 5.
+Operator or semicolon missing before *foo at - line 10.
+Ambiguous use of * resolved as operator * at - line 10.
+Operator or semicolon missing before *foo at - line 12.
+Ambiguous use of * resolved as operator * at - line 12.
 ########
 # toke.c
 use warnings 'misc' ;
@@ -726,6 +1120,14 @@ EXPECT
 Useless use of \E at - line 3.
 ########
 # toke.c
+use feature 'postderef_qq';
+(\$_)->$*;
+"$_->$*";
+(\$_)->$*;
+"$_->$*";
+EXPECT
+########
+# toke.c
 use warnings 'portable' ;
 my $a =  0b011111111111111111111111111111110 ;
    $a =  0b011111111111111111111111111111111 ;
@@ -778,29 +1180,37 @@ Integer overflow in hexadecimal number at - line 8.
 Integer overflow in octal number at - line 11.
 ########
 # toke.c
-BEGIN { $^C = 1; }
-use warnings 'misc';
-dump;
-CORE::dump;
+use warnings 'ambiguous';
+"@mjd_previously_unused_array";        
+no warnings 'ambiguous';
+"@mjd_previously_unused_array2";        
 EXPECT
-dump() better written as CORE::dump() at - line 4.
-- syntax OK
+Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
 ########
 # toke.c
-use warnings 'misc';
-use subs qw/dump/;
-sub dump { print "no warning for overridden dump\n"; }
-dump;
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'ambiguous';
+"@mjd_previously_unused_àrray";        
+no warnings 'ambiguous';
+"@mjd_previously_unused_àrray2";        
 EXPECT
-no warning for overridden dump
+Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5.
 ########
 # toke.c
+use utf8;
+use open qw( :utf8 :std );
 use warnings 'ambiguous';
-"@mjd_previously_unused_array";        
+"@mjd_previously_unused_ぁrrぁy";        
 no warnings 'ambiguous';
-"@mjd_previously_unused_array";        
+"@mjd_previously_unused_ぁrrぁy2";        
+EXPECT
+Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5.
+########
+-w
+# toke.c
+$_ = "@DB::args";        
 EXPECT
-Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
 ########
 # toke.c
 # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
@@ -873,12 +1283,11 @@ Number found where operator expected at (eval 1) line 1, near "5 6"
        (Missing operator before  6?)
 ########
 # toke.c
-use warnings "syntax";
+use warnings "syntax"; no warnings "deprecated";
 $_ = $a = 1;
 $a !=~  /1/;
 $a !=~ m#1#;
 $a !=~/1/;
-$a !=~ ?/?;
 $a !=~ y/1//;
 $a !=~ tr/1//;
 $a !=~ s/1//;
@@ -887,7 +1296,6 @@ no warnings "syntax";
 $a !=~  /1/;
 $a !=~ m#1#;
 $a !=~/1/;
-$a !=~ ?/?;
 $a !=~ y/1//;
 $a !=~ tr/1//;
 $a !=~ s/1//;
@@ -898,27 +1306,6 @@ EXPECT
 !=~ should be !~ at - line 7.
 !=~ should be !~ at - line 8.
 !=~ should be !~ at - line 9.
-!=~ should be !~ at - line 10.
-########
-# toke.c
-our $foo :unique;
-sub pam :locked;
-sub glipp :locked {
-}
-sub whack_eth ($) : locked {
-}
-no warnings 'deprecated';
-our $bar :unique;
-sub zapeth :locked;
-sub ker_plop :locked {
-}
-sub swa_a_p ($) : locked {
-}
-EXPECT
-Use of :unique is deprecated at - line 2.
-Use of :locked is deprecated at - line 3.
-Use of :locked is deprecated at - line 4.
-Use of :locked is deprecated at - line 6.
 ########
 # toke.c
 use warnings "syntax";
@@ -931,8 +1318,16 @@ sub proto_after_hashref(\%$);
 sub proto_after_hashref2(\[%$]);
 sub underscore_last_pos($_);
 sub underscore2($_;$);
-sub underscore_fail($_$);
+sub underscore_fail($_$); sub underscore_fail2 : prototype($_$);
 sub underscore_after_at(@_);
+our sub hour (@$);
+my sub migh (@$);
+use feature 'state';
+state sub estate (@$);
+package other;
+sub hour (@$);
+sub migh (@$);
+sub estate (@$);
 no warnings "syntax";
 sub proto_after_array(@$);
 sub proto_after_hash(%$);
@@ -941,7 +1336,14 @@ EXPECT
 Prototype after '@' for main::proto_after_array : @$ at - line 3.
 Prototype after '%' for main::proto_after_hash : %$ at - line 7.
 Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
+Illegal character after '_' in prototype for main::underscore_fail2 : $_$ at - line 12.
 Prototype after '@' for main::underscore_after_at : @_ at - line 13.
+Prototype after '@' for hour : @$ at - line 14.
+Prototype after '@' for migh : @$ at - line 15.
+Prototype after '@' for estate : @$ at - line 17.
+Prototype after '@' for hour : @$ at - line 19.
+Prototype after '@' for migh : @$ at - line 20.
+Prototype after '@' for estate : @$ at - line 21.
 ########
 # toke.c
 use warnings "ambiguous";
@@ -970,7 +1372,7 @@ my $a = "\o{}";
 EXPECT
 Missing braces on \o{} at - line 3, within string
 Missing right brace on \o{ at - line 4, within string
-Number with no digits at - line 5, within string
+Empty \o{} at - line 5, within string
 BEGIN not safe after errors--compilation aborted at - line 6.
 ########
 # toke.c
@@ -983,29 +1385,66 @@ Non-octal character '8'.  Resolved as "\o{123}" at - line 3.
 ########
 # toke.c
 use warnings;
-my $a = "foo";
-print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2;
+print ref ? "yes\n" : "no\n" foreach [], ''; # ? is unambiguosly an operator
 EXPECT
-Use of ?PATTERN? without explicit operator is deprecated at - line 4.
 yes
 no
-no
+########
+# toke .c
+use warnings;
+$a =~ ?rand?; # ? is not a regex match
+EXPECT
+syntax error at - line 3, near "=~ ?"
+Execution of - aborted due to compilation errors.
 ########
 # toke.c
+BEGIN {
+    if (ord('A') == 193) {
+        print "SKIPPED\n# result varies depending on which ebcdic platform";
+        exit 0;
+    }
+}
 use warnings;
-my $a = "\c{ack}";
 $a = "\c,";
 $a = "\c`";
 no warnings 'syntax';
-$a = "\c{ack}";
 $a = "\c,";
 $a = "\c`";
-no warnings 'deprecated';
 EXPECT
-"\c{" is deprecated and is more clearly written as ";" at - line 3.
-"\c," is more clearly written simply as "l" at - line 4.
-"\c`" is more clearly written simply as "\ " at - line 5.
-"\c{" is deprecated and is more clearly written as ";" at - line 7.
+"\c," is more clearly written simply as "l" at - line 9.
+"\c`" is more clearly written simply as "\ " at - line 10.
+########
+# toke.c
+BEGIN {
+    if (ord('A') == 193) {
+        print "SKIPPED\n# test is ASCII-specific";
+        exit 0;
+    }
+}
+use warnings;
+my $a = "\c{ack}";
+EXPECT
+OPTION fatal
+Use ";" instead of "\c{" at - line 9.
+########
+# toke.c
+BEGIN {
+    if (ord('A') == 65) {
+        print "SKIPPED\n# test is EBCDIC-specific";
+        exit 0;
+    }
+}
+use warnings;
+my $a = "\c{ack}";
+EXPECT
+OPTION fatal
+Sequence "\c{" invalid at - line 9.
+########
+# toke.c
+my $a = "\câ";
+EXPECT
+OPTION fatal
+Character following "\c" must be printable ASCII at - line 2.
 ########
 # toke.c
 use warnings 'syntax' ;
@@ -1030,3 +1469,209 @@ print "ok\n" if
     $@ =~ /Can't find string terminator "\xab" anywhere before EOF/;
 EXPECT
 ok
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'ambiguous' ;
+sub frèd {}
+$a = ${frèd} ;
+no warnings 'ambiguous' ;
+$a = ${frèd} ;
+EXPECT
+Ambiguous use of ${frèd} resolved to $frèd at - line 6.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'ambiguous' ;
+sub f렏 {}
+$a = ${f렏} ;
+no warnings 'ambiguous' ;
+$a = ${f렏} ;
+EXPECT
+Ambiguous use of ${f렏} resolved to $f렏 at - line 6.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+CORE::렏;
+EXPECT
+CORE::렏 is not a keyword at - line 5.
+########
+# toke.c
+# [perl #16249]
+print '';
+eval this_method_is_fake ();
+EXPECT
+Undefined subroutine &main::this_method_is_fake called at - line 4.
+########
+# toke.c
+# [perl #107002] Erroneous ambiguity warnings
+sub { # do not actually call require
+  require a::b . 1; # These used to produce erroneous
+  require a::b + 1; # ambiguity warnings.
+}
+EXPECT
+########
+# toke.c
+# [perl #113094], [perl #119101], since reverted so no warnings generated
+use warnings;
+print "aa" =~ m{^a\{1,2\}$}, "A\n";
+print "aa" =~ m{^a\x\{61\}$}, "B\n";
+print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "C\n";
+print "a\\o" =~ m{^a\\\x\{6F\}$}, "D\n";
+print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "E\n";
+print "a\\\\o"     =~ m{^a\\\\\x\{6F\}$}, "F\n";
+print "aa" =~ m{^a{1,2}$}, "G\n";
+print "aq" =~ m[^a\[a-z\]$], "H\n";
+print "aq" =~ m(^a\(q\)$), "I\n";
+EXPECT
+Illegal hexadecimal digit '\' ignored at - line 5.
+Illegal hexadecimal digit '\' ignored at - line 7.
+Illegal hexadecimal digit '\' ignored at - line 9.
+A
+B
+1C
+D
+1E
+F
+1G
+H
+I
+########
+# toke.c
+#[perl #119123] disallow literal control character variables
+*{
+    Foo
+}; # shouldn't warn on {\n, even though \n is a control character
+EXPECT
+########
+# toke.c
+# [perl #120288] -X at start of line gave spurious warning, where X is not
+# a filetest operator
+-a;
+;-a;
+EXPECT
+########
+# toke.c
+# [perl #124113] Compile-time warning with UTF8 variable in array index
+use warnings;
+use utf8;
+my $𝛃 = 0;
+my @array = (0);
+my $v = $array[ 0 + $𝛃 ];
+   $v = $array[ $𝛃 + 0 ];
+EXPECT
+########
+# toke.c
+# Allow Unicode here doc boundaries
+use warnings;
+use utf8;
+my $v = <<EnFraçais;
+Comme ca!
+EnFraçais
+print $v;
+EXPECT
+Comme ca!
+########
+# toke.c
+# Fix 'Use of "..." without parentheses is ambiguous' warning for
+# Unicode function names.  If not under PERL_UNICODE, this will generate
+# a "Wide character" warning
+use utf8;
+use warnings;
+sub 𝛃(;$) { return 0; }
+my $v = 𝛃 - 5;
+EXPECT
+OPTION regex
+(Wide character.*\n)?Warning: Use of "𝛃" without parentheses is ambiguous
+########
+# RT #4346 Case 1: Warnings for print (...)
+# TODO RT #4346: Warnings for print(...) are inconsistent
+use warnings;
+print ("((\n");
+print (">>\n");
+EXPECT
+print (...) interpreted as function at - line 3.
+print (...) interpreted as function at - line 4.
+((
+>>
+########
+# RT #4346 Case 2: Warnings for print (...)
+use warnings;
+print ("((\n");
+print (">>\n")
+EXPECT
+print (...) interpreted as function at - line 3.
+print (...) interpreted as function at - line 4.
+((
+>>
+########
+# RT #4346 Case 3: Warnings for print (...)
+# TODO RT #4346: Warnings for print(...) are inconsistent
+use warnings;
+print (">>\n");
+print ("((\n");
+EXPECT
+print (...) interpreted as function at - line 3.
+print (...) interpreted as function at - line 4.
+>>
+((
+########
+# RT #4346 Case 4: Warnings for print (...)
+# TODO RT #4346: Warnings for print(...) are inconsistent
+use warnings;
+print (")\n");
+print ("))\n");
+EXPECT
+print (...) interpreted as function at - line 3.
+print (...) interpreted as function at - line 4.
+)
+))
+########
+# NAME  Non-grapheme delimiters
+BEGIN{
+    if (ord('A') == 193) {
+        print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings.";
+        exit 0;
+    }
+}
+use utf8;
+my $a = qr ̂foobar̂;
+EXPECT
+Use of unassigned code point or non-standalone grapheme for a delimiter is not allowed at - line 8, near "= "
+Use of unassigned code point or non-standalone grapheme for a delimiter is not allowed at - line 8, near "= "
+Execution of - aborted due to compilation errors.
+########
+# NAME  [perl #130567] Assertion failure
+BEGIN {
+    if (ord('A') != 65) {
+        print "SKIPPED\n# test is ASCII-specific";
+        exit 0;
+    }
+}
+no warnings "uninitialized";
+$_= "";
+s//\3000/;
+s//"\x{180};;s\221(*$@$`\241\275";/gee;
+s//"s\221\302\302\302\302\302\302\302$@\241\275";/gee;
+EXPECT
+########
+# NAME  [perl #130666] Assertion failure
+no warnings "uninitialized";
+BEGIN{$^H=-1};my $l; s\0$0[$l]\0\0
+EXPECT
+########
+# NAME  [perl #129036] Assertion failure
+BEGIN{$0="";$^H=hex join""=>A00000}p?
+EXPECT
+OPTION fatal
+syntax error at - line 1, at EOF
+Execution of - aborted due to compilation errors.
+########
+# NAME  [perl #130655]
+use utf8;
+qw∘foo ∞ ♥ bar∘
+EXPECT