Skip to content

Commit 60e04ba

Browse files
author
Father Chrysostomos
committed
Enable lex subs everywhere; suppress warning
Adjust tests, too.
1 parent 738155d commit 60e04ba

File tree

5 files changed

+3
-39
lines changed

5 files changed

+3
-39
lines changed

t/lib/croak/toke

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,24 @@ Missing $ on loop variable at - line 1.
9999
# NAME Missing name in "my sub"
100100
use feature 'lexical_subs'; my sub;
101101
EXPECT
102-
The lexical_subs feature is experimental at - line 1.
103102
Missing name in "my sub" at - line 1.
104103
########
105104
# NAME Missing name in "our sub"
106105
use feature 'lexical_subs'; our sub;
107106
EXPECT
108-
The lexical_subs feature is experimental at - line 1.
109107
Missing name in "our sub" at - line 1.
110108
########
111109
# NAME Missing name in "state sub"
112-
use 5.01; use feature 'lexical_subs';
110+
use 5.01;
113111
state sub;
114112
EXPECT
115-
The lexical_subs feature is experimental at - line 2.
116113
Missing name in "state sub" at - line 2.
117114
########
118115
# NAME my sub pack::foo
119116
use feature 'lexical_subs', 'state';
120117
my sub foo::bar;
121118
state sub foo::bear;
122119
EXPECT
123-
The lexical_subs feature is experimental at - line 2.
124-
The lexical_subs feature is experimental at - line 3.
125120
"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar"
126121
"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear"
127122
Execution of - aborted due to compilation errors.

t/lib/warnings/op

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -997,15 +997,11 @@ sub phred { 2 };
997997
state sub jorge { 1 }
998998
sub jorge () { 2 } # should *not* produce redef warnings by default
999999
EXPECT
1000-
The lexical_subs feature is experimental at - line 3.
10011000
Prototype mismatch: sub fred () vs none at - line 4.
10021001
Constant subroutine fred redefined at - line 4.
1003-
The lexical_subs feature is experimental at - line 5.
10041002
Prototype mismatch: sub george: none vs () at - line 6.
1005-
The lexical_subs feature is experimental at - line 7.
10061003
Prototype mismatch: sub phred () vs none at - line 8.
10071004
Constant subroutine phred redefined at - line 8.
1008-
The lexical_subs feature is experimental at - line 9.
10091005
Prototype mismatch: sub jorge: none vs () at - line 10.
10101006
########
10111007
# op.c

t/lib/warnings/toke

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ Use of :locked is deprecated at - line 4.
12281228
Use of :locked is deprecated at - line 6.
12291229
########
12301230
# toke.c
1231-
use warnings "syntax"; use feature 'lexical_subs';
1231+
use warnings "syntax";
12321232
sub proto_after_array(@$);
12331233
sub proto_after_arref(\@$);
12341234
sub proto_after_arref2(\[@$]);
@@ -1257,11 +1257,8 @@ Prototype after '@' for main::proto_after_array : @$ at - line 3.
12571257
Prototype after '%' for main::proto_after_hash : %$ at - line 7.
12581258
Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
12591259
Prototype after '@' for main::underscore_after_at : @_ at - line 13.
1260-
The lexical_subs feature is experimental at - line 14.
12611260
Prototype after '@' for hour : @$ at - line 14.
1262-
The lexical_subs feature is experimental at - line 15.
12631261
Prototype after '@' for migh : @$ at - line 15.
1264-
The lexical_subs feature is experimental at - line 17.
12651262
Prototype after '@' for estate : @$ at - line 17.
12661263
Prototype after '@' for hour : @$ at - line 19.
12671264
Prototype after '@' for migh : @$ at - line 20.

t/op/lexsub.t

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,10 @@ BEGIN {
77
*bar::is = *is;
88
*bar::like = *like;
99
}
10-
plan 152;
11-
12-
# -------------------- Errors with feature disabled -------------------- #
13-
14-
eval "#line 8 foo\nmy sub foo";
15-
is $@, qq 'Experimental "my" subs not enabled at foo line 8.\n',
16-
'my sub unexperimental error';
17-
eval "#line 8 foo\nCORE::state sub foo";
18-
is $@, qq 'Experimental "state" subs not enabled at foo line 8.\n',
19-
'state sub unexperimental error';
20-
eval "#line 8 foo\nour sub foo";
21-
is $@, qq 'Experimental "our" subs not enabled at foo line 8.\n',
22-
'our sub unexperimental error';
10+
plan 149;
2311

2412
# -------------------- our -------------------- #
2513

26-
no warnings "experimental::lexical_subs";
27-
use feature 'lexical_subs';
2814
{
2915
our sub foo { 42 }
3016
is foo, 42, 'calling our sub from same package';

toke.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7781,17 +7781,7 @@ Perl_yylex(pTHX)
77817781
if (isIDFIRST_lazy_if(s,UTF)) {
77827782
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len);
77837783
if (len == 3 && strnEQ(PL_tokenbuf, "sub", 3))
7784-
{
7785-
if (!FEATURE_LEXSUBS_IS_ENABLED)
7786-
Perl_croak(aTHX_
7787-
"Experimental \"%s\" subs not enabled",
7788-
tmp == KEY_my ? "my" :
7789-
tmp == KEY_state ? "state" : "our");
7790-
Perl_ck_warner_d(aTHX_
7791-
packWARN(WARN_EXPERIMENTAL__LEXICAL_SUBS),
7792-
"The lexical_subs feature is experimental");
77937784
goto really_sub;
7794-
}
77957785
PL_in_my_stash = find_in_my_stash(PL_tokenbuf, len);
77967786
if (!PL_in_my_stash) {
77977787
char tmpbuf[1024];

0 commit comments

Comments
 (0)