blob: 71f683ed54705b10c6ea21fe7816b4caeae4a8dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
pad.c AOK
"my" variable %s masks earlier declaration in same scope
my $x;
my $x ;
Variable "%s" will not stay shared
sub x {
my $x;
sub y {
sub { $x }
}
}
sub x {
my $x;
sub y {
$x
}
}
"our" variable %s redeclared (Did you mean "local" instead of "our"?)
our $x;
{
our $x;
}
%s never introduced [pad_leavemy] TODO
__END__
# pad.c
use warnings 'misc' ;
my $x ;
my $x ;
my $y = my $y ;
no warnings 'misc' ;
my $x ;
my $y ;
EXPECT
"my" variable $x masks earlier declaration in same scope at - line 4.
"my" variable $y masks earlier declaration in same statement at - line 5.
########
# pad.c
use warnings 'closure' ;
sub x {
my $x;
sub y {
$x
}
}
EXPECT
Variable "$x" will not stay shared at - line 7.
########
# pad.c
no warnings 'closure' ;
sub x {
my $x;
sub y {
$x
}
}
EXPECT
########
# pad.c
use warnings 'closure' ;
sub x {
my $x;
sub y {
sub { $x }
}
}
EXPECT
Variable "$x" will not stay shared at - line 6.
########
# pad.c
use warnings 'closure' ;
sub x {
my $x;
sub {
$x;
sub y {
$x
}
}->();
}
EXPECT
Variable "$x" will not stay shared at - line 9.
########
# pad.c
use warnings 'closure' ;
my $x;
sub {
$x;
sub f {
sub { $x }->();
}
}->();
EXPECT
########
# pad.c
use warnings 'closure' ;
sub {
my $x;
sub f { $x }
}->();
EXPECT
Variable "$x" is not available at - line 5.
########
# pad.c
use warnings 'closure' ;
sub {
my $x;
eval 'sub f { $x }';
}->();
EXPECT
########
# pad.c
use warnings 'closure' ;
sub {
my $x;
sub f { eval '$x' }
}->();
f();
EXPECT
Variable "$x" is not available at (eval 1) line 2.
########
# pad.c
use warnings 'closure' ;
sub x {
our $x;
sub y {
$x
}
}
EXPECT
########
# pad.c
# see bugid 1754
use warnings 'closure' ;
sub f {
my $x;
sub { eval '$x' };
}
f()->();
EXPECT
Variable "$x" is not available at (eval 1) line 2.
########
# pad.c
no warnings 'closure' ;
sub x {
my $x;
sub y {
sub { $x }
}
}
EXPECT
########
use warnings 'misc' ;
our $x;
{
our $x;
}
EXPECT
"our" variable $x redeclared at - line 4.
(Did you mean "local" instead of "our"?)
|