Skip to content

Commit 2dd81b7

Browse files
tonycozap
authored andcommitted
undeprecate switch and smartmatch
The deprecation warnings don't appear to have had any tests.
1 parent 6868eea commit 2dd81b7

File tree

9 files changed

+179
-235
lines changed

9 files changed

+179
-235
lines changed

lib/warnings.pm

Lines changed: 170 additions & 176 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pod/perldeprecation.pod

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@ Category: "deprecated::subsequent_use_version"
7171

7272
=head2 Perl 5.42
7373

74-
=head3 Smartmatch
75-
76-
Smartmatch is now seen as a failed experiment and was marked as deprecated
77-
in Perl 5.37.10. This includes the C<when> and C<given> keywords, as well
78-
as the smartmatch operator C<~~>. The feature will be removed entirely in the
79-
Perl 5.42.0 production release.
80-
81-
Category: "deprecated::smartmatch"
82-
8374
=head3 Goto Block Construct
8475

8576
C<goto LABEL;> will produce a deprecated warning when jumping into the body

pod/perldiag.pod

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,12 +2775,6 @@ L<perlfunc/getsockopt>.
27752775
arguments are provided in key/value pairs, with the keys being one
27762776
of C<input>, C<output> or C<detail>, followed by a boolean.
27772777

2778-
=item given is deprecated
2779-
2780-
(D deprecated::smartmatch) C<given> depends on smartmatch, which is
2781-
deprecated. It will be removed in Perl 5.42. See the explanation under
2782-
L<perlsyn/Experimental Details on given and when>.
2783-
27842778
=item Global symbol "%s" requires explicit package name (did you forget to
27852779
declare "my %s"?)
27862780

@@ -6219,14 +6213,6 @@ so there can't be any left to fill later parameters.
62196213
overload it: Perl refuses to use the object's underlying structure
62206214
for the smart match.
62216215

6222-
=item Smartmatch is deprecated
6223-
6224-
(D deprecated::smartmatch) This warning is emitted if you
6225-
use the smartmatch (C<~~>) operator. This is a deprecated
6226-
feature. Particularly, its behavior is noticed for being
6227-
unnecessarily complex and unintuitive, and it will be removed
6228-
in Perl 5.42.
6229-
62306216
=item Sorry, hash keys must be smaller than 2**31 bytes
62316217

62326218
(F) You tried to create a hash containing a very large key, where "very
@@ -8237,14 +8223,6 @@ but in actual fact, you got
82378223

82388224
So put in parentheses to say what you really mean.
82398225

8240-
=item when is deprecated
8241-
8242-
(D deprecated::smartmatch) C<when> depends on smartmatch, which is
8243-
deprecated. Additionally, it has several special cases that may
8244-
not be immediately obvious, and it will be removed in Perl 5.42.
8245-
See the explanation
8246-
under L<perlsyn/Experimental Details on given and when>.
8247-
82488226
=item Wide character in %s
82498227

82508228
(S utf8) Perl met a wide character (ordinal >255) when it wasn't

regen/warnings.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# This script is normally invoked from regen.pl.
1818

19-
$VERSION = '1.72';
19+
$VERSION = '1.73';
2020

2121
BEGIN {
2222
require './regen/regen_lib.pl';
@@ -80,7 +80,6 @@ BEGIN
8080
'deprecated::dot_in_inc' => [ 5.025011, DEFAULT_ON],
8181
'deprecated::version_downgrade' => [ 5.035009, DEFAULT_ON],
8282
'deprecated::delimiter_will_be_paired' => [ 5.035010, DEFAULT_ON],
83-
'deprecated::smartmatch' => [ 5.037010, DEFAULT_ON],
8483
'deprecated::missing_import_called_with_args'
8584
=> [ 5.039002, DEFAULT_ON],
8685
'deprecated::subsequent_use_version' => [ 5.039008, DEFAULT_ON],
@@ -188,6 +187,7 @@ BEGIN
188187
# the experiments were successful (or abandonned),
189188
# so no warning bit is needed anymore
190189
my %NO_BIT_FOR = map { ( uc $_ => 1, $_ => 1 ) } qw(
190+
deprecated::smartmatch
191191
experimental::lexical_subs
192192
experimental::postderef
193193
experimental::signatures

t/lib/feature/smartmatch

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ __END__
55
my @x = qw(a b c);
66
my $y = "b" ~~ @x;
77
EXPECT
8-
Smartmatch is deprecated at - line 2.
98
########
109
# NAME explicit disable
1110
no feature "smartmatch";
@@ -21,15 +20,13 @@ use feature "smartmatch";
2120
my @x = qw(a b c);
2221
my $y = "b" ~~ @x;
2322
EXPECT
24-
Smartmatch is deprecated at - line 3.
2523
########
2624
# NAME explicit disable then enable
2725
no feature "smartmatch";
2826
use feature "smartmatch";
2927
my @x = qw(a b c);
3028
my $y = "b" ~~ @x;
3129
EXPECT
32-
Smartmatch is deprecated at - line 4.
3330
########
3431
# NAME implicit disable
3532
use v5.41;
@@ -46,4 +43,3 @@ use feature "smartmatch";
4643
my @x = qw(a b c);
4744
my $y = "b" ~~ @x;
4845
EXPECT
49-
Smartmatch is deprecated at - line 4.

t/op/smartmatch.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ BEGIN {
88
use strict;
99
use warnings;
1010
no warnings 'uninitialized';
11-
no warnings 'deprecated'; # smartmatch is deprecated and will be removed in 5.042
1211

1312
++$|;
1413

t/op/switch.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ BEGIN {
88

99
use strict;
1010
use warnings;
11-
no warnings 'deprecated';
1211

1312
plan tests => 197;
1413

toke.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6780,9 +6780,6 @@ yyl_tilde(pTHX_ char *s)
67806780
if (!PL_lex_allbrackets && PL_lex_fakeeof >= LEX_FAKEEOF_COMPARE)
67816781
TOKEN(0);
67826782
s += 2;
6783-
Perl_ck_warner_d(aTHX_
6784-
packWARN(WARN_DEPRECATED__SMARTMATCH),
6785-
"Smartmatch is deprecated");
67866783
NCEop(OP_SMARTMATCH);
67876784
}
67886785
s++;
@@ -8311,8 +8308,6 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct
83118308

83128309
case KEY_given:
83138310
pl_yylval.ival = CopLINE(PL_curcop);
8314-
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED__SMARTMATCH),
8315-
"given is deprecated");
83168311
OPERATOR(KW_GIVEN);
83178312

83188313
case KEY_glob:
@@ -8822,9 +8817,6 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct
88228817
if (!PL_lex_allbrackets && PL_lex_fakeeof >= LEX_FAKEEOF_NONEXPR)
88238818
return REPORT(0);
88248819
pl_yylval.ival = CopLINE(PL_curcop);
8825-
Perl_ck_warner_d(aTHX_
8826-
packWARN(WARN_DEPRECATED__SMARTMATCH),
8827-
"when is deprecated");
88288820
OPERATOR(KW_WHEN);
88298821

88308822
case KEY_while:

warnings.h

Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)