xref: /openbsd/gnu/usr.bin/perl/t/lib/warnings/toke (revision cca36db2)
1toke.c	AOK
2
3    we seem to have lost a few ambiguous warnings!!
4
5
6 		$a = <<;
7 		Use of comma-less variable list is deprecated
8		(called 3 times via depcom)
9
10     \1 better written as $1
11 	use warnings 'syntax' ;
12 	s/(abc)/\1/;
13
14     warn(warn_nosemi)
15     Semicolon seems to be missing
16	$a = 1
17	&time ;
18
19
20     Reversed %c= operator
21	my $a =+ 2 ;
22	$a =- 2 ;
23	$a =* 2 ;
24	$a =% 2 ;
25	$a =& 2 ;
26	$a =. 2 ;
27	$a =^ 2 ;
28	$a =| 2 ;
29	$a =< 2 ;
30	$a =/ 2 ;
31
32     Multidimensional syntax %.*s not supported
33	my $a = $a[1,2] ;
34
35     You need to quote \"%s\""
36	sub fred {} ; $SIG{TERM} = fred;
37
38     Scalar value %.*s better written as $%.*s"
39	@a[3] = 2;
40	@a{3} = 2;
41
42     Can't use \\%c to mean $%c in expression
43	$_ = "ab" ; s/(ab)/\1/e;
44
45     Unquoted string "abc" may clash with future reserved word at - line 3.
46     warn(warn_reserved
47	$a = abc;
48
49     Possible attempt to separate words with commas
50	@a = qw(a, b, c) ;
51
52     Possible attempt to put comments in qw() list
53	@a = qw(a b # c) ;
54
55     %s (...) interpreted as function
56	print ("")
57	printf ("")
58	sort ("")
59
60     Ambiguous use of %c{%s%s} resolved to %c%s%s
61	$a = ${time[2]}
62	$a = ${time{2}}
63
64
65     Ambiguous use of %c{%s} resolved to %c%s
66	$a = ${time}
67	sub fred {} $a = ${fred}
68
69     Misplaced _ in number
70	$a = 1_2;
71	$a = 1_2345_6;
72
73    Bareword \"%s\" refers to nonexistent package
74	$a = FRED:: ;
75
76    Ambiguous call resolved as CORE::%s(), qualify as such or use &
77	sub time {}
78	my $a = time()
79
80    Unrecognized escape \\%c passed through
81        $a = "\m" ;
82
83    %s number > %s non-portable
84        my $a =  0b011111111111111111111111111111110 ;
85        $a =  0b011111111111111111111111111111111 ;
86        $a =  0b111111111111111111111111111111111 ;
87        $a =  0x0fffffffe ;
88        $a =  0x0ffffffff ;
89        $a =  0x1ffffffff ;
90        $a =  0037777777776 ;
91        $a =  0037777777777 ;
92        $a =  0047777777777 ;
93
94    Integer overflow in binary number
95        my $a =  0b011111111111111111111111111111110 ;
96        $a =  0b011111111111111111111111111111111 ;
97        $a =  0b111111111111111111111111111111111 ;
98        $a =  0x0fffffffe ;
99        $a =  0x0ffffffff ;
100        $a =  0x1ffffffff ;
101        $a =  0037777777776 ;
102        $a =  0037777777777 ;
103        $a =  0047777777777 ;
104
105    dump() better written as CORE::dump()
106
107    Use of /c modifier is meaningless without /g
108
109    Use of /c modifier is meaningless in s///
110
111    Mandatory Warnings
112    ------------------
113    Use of "%s" without parentheses is ambiguous	[check_uni]
114        rand + 4
115
116    Ambiguous use of -%s resolved as -&%s() 		[yylex]
117        sub fred {} ; - fred ;
118
119    Precedence problem: open %.*s should be open(%.*s)	[yylex]
120    	open FOO || die;
121
122    Operator or semicolon missing before %c%s		[yylex]
123    Ambiguous use of %c resolved as operator %c
124        *foo *foo
125
126__END__
127# toke.c
128format STDOUT =
129@<<<  @|||  @>>>  @>>>
130$a    $b    "abc" 'def'
131.
132no warnings 'deprecated' ;
133format STDOUT =
134@<<<  @|||  @>>>  @>>>
135$a    $b    "abc" 'def'
136.
137EXPECT
138Use of comma-less variable list is deprecated at - line 4.
139Use of comma-less variable list is deprecated at - line 4.
140Use of comma-less variable list is deprecated at - line 4.
141########
142# toke.c
143$a = <<;
144
145no warnings 'deprecated' ;
146$a = <<;
147
148EXPECT
149Use of bare << to mean <<"" is deprecated at - line 2.
150########
151# toke.c
152use warnings 'syntax' ;
153s/(abc)/\1/;
154no warnings 'syntax' ;
155s/(abc)/\1/;
156EXPECT
157\1 better written as $1 at - line 3.
158########
159# toke.c
160use warnings 'semicolon' ;
161$a = 1
162&time ;
163no warnings 'semicolon' ;
164$a = 1
165&time ;
166EXPECT
167Semicolon seems to be missing at - line 3.
168########
169# toke.c
170use warnings 'syntax' ;
171my $a =+ 2 ;
172$a =- 2 ;
173$a =* 2 ;
174$a =% 2 ;
175$a =& 2 ;
176$a =. 2 ;
177$a =^ 2 ;
178$a =| 2 ;
179$a =< 2 ;
180$a =/ 2 ;
181EXPECT
182Reversed += operator at - line 3.
183Reversed -= operator at - line 4.
184Reversed *= operator at - line 5.
185Reversed %= operator at - line 6.
186Reversed &= operator at - line 7.
187Reversed .= operator at - line 8.
188Reversed ^= operator at - line 9.
189Reversed |= operator at - line 10.
190Reversed <= operator at - line 11.
191syntax error at - line 8, near "=."
192syntax error at - line 9, near "=^"
193syntax error at - line 10, near "=|"
194Unterminated <> operator at - line 11.
195########
196# toke.c
197no warnings 'syntax' ;
198my $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 ;
208EXPECT
209syntax error at - line 8, near "=."
210syntax error at - line 9, near "=^"
211syntax error at - line 10, near "=|"
212Unterminated <> operator at - line 11.
213########
214# toke.c
215use warnings 'syntax' ;
216my $a = $a[1,2] ;
217no warnings 'syntax' ;
218my $a = $a[1,2] ;
219EXPECT
220Multidimensional syntax $a[1,2] not supported at - line 3.
221########
222# toke.c
223use warnings 'syntax' ;
224sub fred {} ; $SIG{TERM} = fred;
225no warnings 'syntax' ;
226$SIG{TERM} = fred;
227EXPECT
228You need to quote "fred" at - line 3.
229########
230# toke.c
231use warnings 'syntax' ;
232@a[3] = 2;
233@a{3} = 2;
234no warnings 'syntax' ;
235@a[3] = 2;
236@a{3} = 2;
237EXPECT
238Scalar value @a[3] better written as $a[3] at - line 3.
239Scalar value @a{3} better written as $a{3} at - line 4.
240########
241# toke.c
242use warnings 'syntax' ;
243$_ = "ab" ;
244s/(ab)/\1/e;
245no warnings 'syntax' ;
246$_ = "ab" ;
247s/(ab)/\1/e;
248EXPECT
249Can't use \1 to mean $1 in expression at - line 4.
250########
251# toke.c
252use warnings 'reserved' ;
253$a = abc;
254$a = { def
255
256=> 1 };
257no warnings 'reserved' ;
258$a = abc;
259EXPECT
260Unquoted string "abc" may clash with future reserved word at - line 3.
261########
262# toke.c
263use warnings 'qw' ;
264@a = qw(a, b, c) ;
265no warnings 'qw' ;
266@a = qw(a, b, c) ;
267EXPECT
268Possible attempt to separate words with commas at - line 3.
269########
270# toke.c
271use warnings 'qw' ;
272@a = qw(a b #) ;
273no warnings 'qw' ;
274@a = qw(a b #) ;
275EXPECT
276Possible attempt to put comments in qw() list at - line 3.
277########
278# toke.c
279use warnings 'syntax' ;
280print ("");
281print ("") and $x = 1;
282print ("") or die;
283print ("") // die;
284print (1+2) * 3 if 0; # only this one should warn
285print (1+2) if 0;
286EXPECT
287print (...) interpreted as function at - line 7.
288########
289# toke.c
290no warnings 'syntax' ;
291print ("")
292EXPECT
293
294########
295# toke.c
296use warnings 'syntax' ;
297printf ("");
298printf ("") . '';
299EXPECT
300printf (...) interpreted as function at - line 4.
301########
302# toke.c
303no warnings 'syntax' ;
304printf ("")
305EXPECT
306
307########
308# toke.c
309use warnings 'syntax' ;
310sort ("");
311sort ("") . '';
312EXPECT
313sort (...) interpreted as function at - line 4.
314########
315# toke.c
316no warnings 'syntax' ;
317sort ("")
318EXPECT
319
320########
321# toke.c
322use warnings 'ambiguous' ;
323$a = ${time[2]};
324no warnings 'ambiguous' ;
325$a = ${time[2]};
326EXPECT
327Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
328########
329# toke.c
330use warnings 'ambiguous' ;
331$a = ${time{2}};
332EXPECT
333Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
334########
335# toke.c
336no warnings 'ambiguous' ;
337$a = ${time{2}};
338EXPECT
339
340########
341# toke.c
342use warnings 'ambiguous' ;
343$a = ${time} ;
344no warnings 'ambiguous' ;
345$a = ${time} ;
346EXPECT
347Ambiguous use of ${time} resolved to $time at - line 3.
348########
349# toke.c
350use warnings 'ambiguous' ;
351sub fred {}
352$a = ${fred} ;
353no warnings 'ambiguous' ;
354$a = ${fred} ;
355EXPECT
356Ambiguous use of ${fred} resolved to $fred at - line 4.
357########
358# toke.c
359use warnings 'syntax' ;
360$a = _123; print "$a\n";		#( 3	string)
361$a = 1_23; print "$a\n";
362$a = 12_3; print "$a\n";
363$a = 123_; print "$a\n";		#  6
364$a = _+123; print "$a\n";		#  7	string)
365$a = +_123; print "$a\n";		#( 8	string)
366$a = +1_23; print "$a\n";
367$a = +12_3; print "$a\n";
368$a = +123_; print "$a\n";		# 11
369$a = _-123; print "$a\n";		#(12	string)
370$a = -_123; print "$a\n";		#(13	string)
371$a = -1_23; print "$a\n";
372$a = -12_3; print "$a\n";
373$a = -123_; print "$a\n";		# 16
374$a = 123._456; print "$a\n";		# 17
375$a = 123.4_56; print "$a\n";
376$a = 123.45_6; print "$a\n";
377$a = 123.456_; print "$a\n";		# 20
378$a = +123._456; print "$a\n";		# 21
379$a = +123.4_56; print "$a\n";
380$a = +123.45_6; print "$a\n";
381$a = +123.456_; print "$a\n";		# 24
382$a = -123._456; print "$a\n";		# 25
383$a = -123.4_56; print "$a\n";
384$a = -123.45_6; print "$a\n";
385$a = -123.456_; print "$a\n";		# 28
386$a = 123.456E_12; printf("%.0f\n", $a);	# 29
387$a = 123.456E1_2; printf("%.0f\n", $a);
388$a = 123.456E12_; printf("%.0f\n", $a);	# 31
389$a = 123.456E_+12; printf("%.0f\n", $a);	# 32
390$a = 123.456E+_12; printf("%.0f\n", $a);	# 33
391$a = 123.456E+1_2; printf("%.0f\n", $a);
392$a = 123.456E+12_; printf("%.0f\n", $a);	# 35
393$a = 123.456E_-12; print "$a\n";	# 36
394$a = 123.456E-_12; print "$a\n";	# 37
395$a = 123.456E-1_2; print "$a\n";
396$a = 123.456E-12_; print "$a\n";	# 39
397$a = 1__23; print "$a\n";		# 40
398$a = 12.3__4; print "$a\n";		# 41
399$a = 12.34e1__2; printf("%.0f\n", $a);	# 42
400no warnings 'syntax' ;
401$a = _123; print "$a\n";
402$a = 1_23; print "$a\n";
403$a = 12_3; print "$a\n";
404$a = 123_; print "$a\n";
405$a = _+123; print "$a\n";
406$a = +_123; print "$a\n";
407$a = +1_23; print "$a\n";
408$a = +12_3; print "$a\n";
409$a = +123_; print "$a\n";
410$a = _-123; print "$a\n";
411$a = -_123; print "$a\n";
412$a = -1_23; print "$a\n";
413$a = -12_3; print "$a\n";
414$a = -123_; print "$a\n";
415$a = 123._456; print "$a\n";
416$a = 123.4_56; print "$a\n";
417$a = 123.45_6; print "$a\n";
418$a = 123.456_; print "$a\n";
419$a = +123._456; print "$a\n";
420$a = +123.4_56; print "$a\n";
421$a = +123.45_6; print "$a\n";
422$a = +123.456_; print "$a\n";
423$a = -123._456; print "$a\n";
424$a = -123.4_56; print "$a\n";
425$a = -123.45_6; print "$a\n";
426$a = -123.456_; print "$a\n";
427$a = 123.456E_12; printf("%.0f\n", $a);
428$a = 123.456E1_2; printf("%.0f\n", $a);
429$a = 123.456E12_; printf("%.0f\n", $a);
430$a = 123.456E_+12; printf("%.0f\n", $a);
431$a = 123.456E+_12; printf("%.0f\n", $a);
432$a = 123.456E+1_2; printf("%.0f\n", $a);
433$a = 123.456E+12_; printf("%.0f\n", $a);
434$a = 123.456E_-12; print "$a\n";
435$a = 123.456E-_12; print "$a\n";
436$a = 123.456E-1_2; print "$a\n";
437$a = 123.456E-12_; print "$a\n";
438$a = 1__23; print "$a\n";
439$a = 12.3__4; print "$a\n";
440$a = 12.34e1__2; printf("%.0f\n", $a);
441EXPECT
442OPTIONS regex
443Misplaced _ in number at - line 6.
444Misplaced _ in number at - line 11.
445Misplaced _ in number at - line 16.
446Misplaced _ in number at - line 17.
447Misplaced _ in number at - line 20.
448Misplaced _ in number at - line 21.
449Misplaced _ in number at - line 24.
450Misplaced _ in number at - line 25.
451Misplaced _ in number at - line 28.
452Misplaced _ in number at - line 29.
453Misplaced _ in number at - line 31.
454Misplaced _ in number at - line 32.
455Misplaced _ in number at - line 33.
456Misplaced _ in number at - line 35.
457Misplaced _ in number at - line 36.
458Misplaced _ in number at - line 37.
459Misplaced _ in number at - line 39.
460Misplaced _ in number at - line 40.
461Misplaced _ in number at - line 41.
462Misplaced _ in number at - line 42.
463_123
464123
465123
466123
467123
468_123
469123
470123
471123
472-123
473-_123
474-123
475-123
476-123
477123.456
478123.456
479123.456
480123.456
481123.456
482123.456
483123.456
484123.456
485-123.456
486-123.456
487-123.456
488-123.456
489123456000000000
490123456000000000
491123456000000000
492123456000000000
493123456000000000
494123456000000000
495123456000000000
4961.23456e-0?10
4971.23456e-0?10
4981.23456e-0?10
4991.23456e-0?10
500123
50112.34
50212340000000000
503_123
504123
505123
506123
507123
508_123
509123
510123
511123
512-123
513-_123
514-123
515-123
516-123
517123.456
518123.456
519123.456
520123.456
521123.456
522123.456
523123.456
524123.456
525-123.456
526-123.456
527-123.456
528-123.456
529123456000000000
530123456000000000
531123456000000000
532123456000000000
533123456000000000
534123456000000000
535123456000000000
5361.23456e-0?10
5371.23456e-0?10
5381.23456e-0?10
5391.23456e-0?10
540123
54112.34
54212340000000000
543########
544# toke.c
545use warnings 'bareword' ;
546#line 25 "bar"
547$a = FRED:: ;
548no warnings 'bareword' ;
549#line 25 "bar"
550$a = FRED:: ;
551EXPECT
552Bareword "FRED::" refers to nonexistent package at bar line 25.
553########
554# toke.c
555use warnings 'ambiguous' ;
556sub time {}
557my $a = time() ;
558no warnings 'ambiguous' ;
559my $b = time() ;
560EXPECT
561Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
562########
563# toke.c
564use warnings ;
565eval <<'EOE';
566#  line 30 "foo"
567warn "yelp";
568{
569  $_ = " \x{123} " ;
570}
571EOE
572EXPECT
573yelp at foo line 30.
574########
575# toke.c
576my $a = rand + 4 ;
577EXPECT
578Warning: Use of "rand" without parentheses is ambiguous at - line 2.
579########
580# toke.c
581$^W = 0 ;
582my $a = rand + 4 ;
583{
584    no warnings 'ambiguous' ;
585    $a = rand + 4 ;
586    use warnings 'ambiguous' ;
587    $a = rand + 4 ;
588}
589$a = rand + 4 ;
590EXPECT
591Warning: Use of "rand" without parentheses is ambiguous at - line 3.
592Warning: Use of "rand" without parentheses is ambiguous at - line 8.
593Warning: Use of "rand" without parentheses is ambiguous at - line 10.
594########
595# toke.c
596use warnings "ambiguous";
597print for keys %+; # should not warn
598EXPECT
599########
600# toke.c
601sub fred {};
602-fred ;
603EXPECT
604Ambiguous use of -fred resolved as -&fred() at - line 3.
605########
606# toke.c
607$^W = 0 ;
608sub fred {} ;
609-fred ;
610{
611    no warnings 'ambiguous' ;
612    -fred ;
613    use warnings 'ambiguous' ;
614    -fred ;
615}
616-fred ;
617EXPECT
618Ambiguous use of -fred resolved as -&fred() at - line 4.
619Ambiguous use of -fred resolved as -&fred() at - line 9.
620Ambiguous use of -fred resolved as -&fred() at - line 11.
621########
622# toke.c
623open FOO || time;
624EXPECT
625Precedence problem: open FOO should be open(FOO) at - line 2.
626########
627# toke.c (and [perl #16184])
628open FOO => "<&0"; close FOO;
629EXPECT
630########
631# toke.c
632$^W = 0 ;
633open FOO || time;
634{
635    no warnings 'precedence' ;
636    open FOO || time;
637    use warnings 'precedence' ;
638    open FOO || time;
639}
640open FOO || time;
641EXPECT
642Precedence problem: open FOO should be open(FOO) at - line 3.
643Precedence problem: open FOO should be open(FOO) at - line 8.
644Precedence problem: open FOO should be open(FOO) at - line 10.
645########
646# toke.c
647$^W = 0 ;
648*foo *foo ;
649{
650    no warnings 'ambiguous' ;
651    *foo *foo ;
652    use warnings 'ambiguous' ;
653    *foo *foo ;
654}
655*foo *foo ;
656EXPECT
657Operator or semicolon missing before *foo at - line 3.
658Ambiguous use of * resolved as operator * at - line 3.
659Operator or semicolon missing before *foo at - line 8.
660Ambiguous use of * resolved as operator * at - line 8.
661Operator or semicolon missing before *foo at - line 10.
662Ambiguous use of * resolved as operator * at - line 10.
663########
664# toke.c
665use warnings 'misc' ;
666my $a = "\m" ;
667no warnings 'misc' ;
668$a = "\m" ;
669EXPECT
670Unrecognized escape \m passed through at - line 3.
671########
672# toke.c
673use warnings 'portable' ;
674my $a =  0b011111111111111111111111111111110 ;
675   $a =  0b011111111111111111111111111111111 ;
676   $a =  0b111111111111111111111111111111111 ;
677   $a =  0x0fffffffe ;
678   $a =  0x0ffffffff ;
679   $a =  0x1ffffffff ;
680   $a =  0037777777776 ;
681   $a =  0037777777777 ;
682   $a =  0047777777777 ;
683no warnings 'portable' ;
684   $a =  0b011111111111111111111111111111110 ;
685   $a =  0b011111111111111111111111111111111 ;
686   $a =  0b111111111111111111111111111111111 ;
687   $a =  0x0fffffffe ;
688   $a =  0x0ffffffff ;
689   $a =  0x1ffffffff ;
690   $a =  0037777777776 ;
691   $a =  0037777777777 ;
692   $a =  0047777777777 ;
693EXPECT
694Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
695Hexadecimal number > 0xffffffff non-portable at - line 8.
696Octal number > 037777777777 non-portable at - line 11.
697########
698# toke.c
699use warnings 'overflow' ;
700my $a =  0b011111111111111111111111111111110 ;
701   $a =  0b011111111111111111111111111111111 ;
702   $a =  0b10000000000000000000000000000000000000000000000000000000000000000 ;
703   $a =  0x0fffffffe ;
704   $a =  0x0ffffffff ;
705   $a =  0x10000000000000000 ;
706   $a =  0037777777776 ;
707   $a =  0037777777777 ;
708   $a =  002000000000000000000000;
709no warnings 'overflow' ;
710   $a =  0b011111111111111111111111111111110 ;
711   $a =  0b011111111111111111111111111111111 ;
712   $a =  0b10000000000000000000000000000000000000000000000000000000000000000 ;
713   $a =  0x0fffffffe ;
714   $a =  0x0ffffffff ;
715   $a =  0x10000000000000000 ;
716   $a =  0037777777776 ;
717   $a =  0037777777777 ;
718   $a =  002000000000000000000000;
719EXPECT
720Integer overflow in binary number at - line 5.
721Integer overflow in hexadecimal number at - line 8.
722Integer overflow in octal number at - line 11.
723########
724# toke.c
725BEGIN { $^C = 1; }
726use warnings 'misc';
727dump;
728CORE::dump;
729EXPECT
730dump() better written as CORE::dump() at - line 4.
731- syntax OK
732########
733# toke.c
734use warnings 'misc';
735use subs qw/dump/;
736sub dump { print "no warning for overriden dump\n"; }
737dump;
738EXPECT
739no warning for overriden dump
740########
741# toke.c
742use warnings 'ambiguous';
743"@mjd_previously_unused_array";
744no warnings 'ambiguous';
745"@mjd_previously_unused_array";
746EXPECT
747Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
748########
749# toke.c
750# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
751use warnings 'regexp';
752"foo" =~ /foo/c;
753"foo" =~ /foo/cg;
754no warnings 'regexp';
755"foo" =~ /foo/c;
756"foo" =~ /foo/cg;
757EXPECT
758Use of /c modifier is meaningless without /g at - line 4.
759########
760# toke.c
761# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
762use warnings 'regexp';
763$_ = "ab" ;
764s/ab/ab/c;
765s/ab/ab/cg;
766no warnings 'regexp';
767s/ab/ab/c;
768s/ab/ab/cg;
769EXPECT
770Use of /c modifier is meaningless in s/// at - line 5.
771Use of /c modifier is meaningless in s/// at - line 6.
772########
773-wa
774# toke.c
775# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
776print "@F\n";
777EXPECT
778
779########
780-w
781# toke.c
782# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
783print "@F\n";
784EXPECT
785Possible unintended interpolation of @F in string at - line 4.
786Name "main::F" used only once: possible typo at - line 4.
787########
788-wa
789# toke.c
790# 20020414 mjd-perl-patch+@plover.com
791EXPECT
792
793########
794# toke.c
795# 20020414 mjd-perl-patch+@plover.com
796# In 5.7.3, this emitted "Possible unintended interpolation" warnings
797use warnings 'ambiguous';
798$s = "(@-)(@+)";
799EXPECT
800
801########
802# toke.c
803# mandatory warning
804eval q/if ($a) { } elseif ($b) { }/;
805no warnings "syntax";
806eval q/if ($a) { } elseif ($b) { }/;
807EXPECT
808elseif should be elsif at (eval 1) line 1.
809########
810# toke.c
811# mandatory warning
812eval q/5 6/;
813no warnings "syntax";
814eval q/5 6/;
815EXPECT
816Number found where operator expected at (eval 1) line 1, near "5 6"
817	(Missing operator before  6?)
818########
819# toke.c
820use warnings "syntax";
821$_ = $a = 1;
822$a !=~  /1/;
823$a !=~ m#1#;
824$a !=~/1/;
825$a !=~ ?/?;
826$a !=~ y/1//;
827$a !=~ tr/1//;
828$a !=~ s/1//;
829$a != ~/1/;
830no warnings "syntax";
831$a !=~  /1/;
832$a !=~ m#1#;
833$a !=~/1/;
834$a !=~ ?/?;
835$a !=~ y/1//;
836$a !=~ tr/1//;
837$a !=~ s/1//;
838EXPECT
839!=~ should be !~ at - line 4.
840!=~ should be !~ at - line 5.
841!=~ should be !~ at - line 6.
842!=~ should be !~ at - line 7.
843!=~ should be !~ at - line 8.
844!=~ should be !~ at - line 9.
845!=~ should be !~ at - line 10.
846########
847# toke.c
848our $foo :unique;
849sub pam :locked;
850sub glipp :locked {
851}
852sub whack_eth ($) : locked {
853}
854no warnings 'deprecated';
855our $bar :unique;
856sub zapeth :locked;
857sub ker_plop :locked {
858}
859sub swa_a_p ($) : locked {
860}
861EXPECT
862Use of :unique is deprecated at - line 2.
863Use of :locked is deprecated at - line 3.
864Use of :locked is deprecated at - line 4.
865Use of :locked is deprecated at - line 6.
866########
867# toke.c
868use warnings "syntax";
869sub proto_after_array(@$);
870sub proto_after_arref(\@$);
871sub proto_after_arref2(\[@$]);
872sub proto_after_arref3(\[@$]_);
873sub proto_after_hash(%$);
874sub proto_after_hashref(\%$);
875sub proto_after_hashref2(\[%$]);
876sub underscore_last_pos($_);
877sub underscore2($_;$);
878sub underscore_fail($_$);
879sub underscore_after_at(@_);
880no warnings "syntax";
881sub proto_after_array(@$);
882sub proto_after_hash(%$);
883sub underscore_fail($_$);
884EXPECT
885Prototype after '@' for main::proto_after_array : @$ at - line 3.
886Prototype after '%' for main::proto_after_hash : %$ at - line 7.
887Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
888Prototype after '@' for main::underscore_after_at : @_ at - line 13.
889########
890# toke.c
891use warnings "ambiguous";
892"foo\nn" =~ /^foo$\n/;
893"foo\nn" =~ /^foo${\}n/;
894my $foo = qr/^foo$\n/;
895my $bar = qr/^foo${\}n/;
896no warnings "ambiguous";
897"foo\nn" =~ /^foo$\n/;
898"foo\nn" =~ /^foo${\}n/;
899my $foo = qr/^foo$\n/;
900my $bar = qr/^foo${\}n/;
901EXPECT
902Possible unintended interpolation of $\ in regex at - line 3.
903Possible unintended interpolation of $\ in regex at - line 5.
904########
905# toke.c
906use feature 'state';
907# This one is fine as an empty attribute list
908my $holy_Einstein : = '';
909# This one is deprecated
910my $krunch := 4;
911our $FWISK_FWISK_FWIZZACH_FWACH_ZACHITTY_ZICH_SHAZZATZ_FWISK := '';
912state $thump := 'Trumpets';
913# Lather rinse repeat in my usual obsessive style
914my @holy_perfect_pitch : = ();
915my @zok := ();
916our @GUKGUK := ();
917# state @widget_mark := ();
918my %holy_seditives : = ();
919my %bang := ();
920our %GIGAZING := ();
921# state %hex := ();
922no warnings 'deprecated';
923my $holy_giveaways : = '';
924my $eee_yow := [];
925our $TWOYYOYYOING_THUK_UGH := 1 == 1;
926state $octothorn := 'Tinky Winky';
927my @holy_Taj_Mahal : = ();
928my @touche := ();
929our @PLAK_DAK_THUK_FRIT := ();
930# state @hash_mark := ();
931my %holy_priceless_collection_of_Etruscan_snoods : = ();
932my %wham_eth := ();
933our %THWUK := ();
934# state %octalthorpe := ();
935use warnings;
936my $holy_sewer_pipe : = '';
937my $thunk := undef;
938our $BLIT := time;
939state $crunch := 'Laa Laa';
940my @glurpp := ();
941my @holy_harem : = ();
942our @FABADAP := ();
943# state @square := ();
944my %holy_pin_cushions : = ();
945my %swoosh := ();
946our %RRRRR := ();
947# state %scratchmark := ();
948EXPECT
949Use of := for an empty attribute list is deprecated at - line 6.
950Use of := for an empty attribute list is deprecated at - line 7.
951Use of := for an empty attribute list is deprecated at - line 8.
952Use of := for an empty attribute list is deprecated at - line 11.
953Use of := for an empty attribute list is deprecated at - line 12.
954Use of := for an empty attribute list is deprecated at - line 15.
955Use of := for an empty attribute list is deprecated at - line 16.
956Use of := for an empty attribute list is deprecated at - line 33.
957Use of := for an empty attribute list is deprecated at - line 34.
958Use of := for an empty attribute list is deprecated at - line 35.
959Use of := for an empty attribute list is deprecated at - line 36.
960Use of := for an empty attribute list is deprecated at - line 38.
961Use of := for an empty attribute list is deprecated at - line 41.
962Use of := for an empty attribute list is deprecated at - line 42.
963