This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_scalar() tail-call optimise
[perl5.git] / t / lib / warnings / op
index 8529783..4d0b002 100644 (file)
@@ -2021,3 +2021,45 @@ $a.$b.$c;
 EXPECT
 Useless use of concatenation (.) or string in void context at - line 4.
 Useless use of concatenation (.) or string in void context at - line 5.
+########
+# PL_curcop tracked correctly in Perl_scalar()
+use warnings;
+my $scalar = do {
+    no warnings 'void';
+    1,2,3,4,5;
+};
+EXPECT
+########
+# PL_curcop tracked correctly in Perl_list()
+use warnings;
+my @array = do {
+    no warnings 'void';
+    1,2,3,4,5;
+};
+EXPECT
+########
+# TODO PL_curcop restored correctly in Perl_scalar()
+use warnings;
+my $scalar = do {
+    my $x = 1;
+    11,12,
+    do {
+        no warnings 'void';
+        my $x = 2;
+        21,22,
+    },
+    31,32,
+    do {
+        my $x = 3;
+        41,42,
+    },
+    51,52
+};
+EXPECT
+Useless use of a constant (11) in void context at - line 5.
+Useless use of a constant (12) in void context at - line 5.
+Useless use of a constant (31) in void context at - line 11.
+Useless use of a constant (32) in void context at - line 11.
+Useless use of a constant (41) in void context at - line 14.
+Useless use of a constant (42) in void context at - line 14.
+Useless use of a constant (51) in void context at - line 16.