use autodie;
use strict;
use warnings;
+no warnings 'experimental::aggref';
use File::Find;
use ExtUtils::MM_Unix;
use version;
}
use warnings;
+no warnings 'experimental::aggref';
use strict;
use Test::More;
# Warnings Categories added in Perl 5.019
- 'experimental::postderef'=> 112,
- 'syscalls' => 114,
+ 'experimental::aggref'=> 112,
+ 'experimental::postderef'=> 114,
+ 'syscalls' => 116,
);
our %Bits = (
- 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05", # [0..57]
+ 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..58]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [29]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [30]
'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
- 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x01", # [51..56]
+ 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x05", # [51..57]
+ 'experimental::aggref'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [56]
'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [52]
'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [53]
- 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [56]
+ 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [57]
'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [54]
'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [55]
'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [46]
'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
- 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [5..11,57]
+ 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [5..11,58]
'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [50]
'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00", # [28..38,47]
- 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [57]
+ 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [58]
'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [39]
'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [40]
'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [41]
);
our %DeadBits = (
- 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x0a", # [0..57]
+ 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..58]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [29]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [30]
'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
- 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x02", # [51..56]
+ 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x0a", # [51..57]
+ 'experimental::aggref'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [56]
'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [52]
'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [53]
- 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [56]
+ 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [57]
'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [54]
'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [55]
'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [46]
'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
- 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [5..11,57]
+ 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [5..11,58]
'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [50]
'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00", # [28..38,47]
- 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [57]
+ 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [58]
'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [39]
'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [40]
'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [41]
);
$NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-$DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x01", # [2,52,53,56,54,55,4,22,23,25]
-$LAST_BIT = 116 ;
+$DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x05", # [2,56,52,53,57,54,55,4,22,23,25]
+$LAST_BIT = 118 ;
$BYTES = 15 ;
$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
/* Defer checks to run-time if we have a scalar arg */
if (kid->op_type == OP_RV2AV || kid->op_type == OP_PADAV)
op_lvalue(kid, type);
- else scalar(kid);
+ else {
+ scalar(kid);
+ /* diag_listed_as: push on reference is experimental */
+ Perl_ck_warner_d(aTHX_
+ packWARN(WARN_EXPERIMENTAL__AGGREF),
+ "%s on reference is experimental",
+ PL_op_desc[type]);
+ }
break;
case OA_HVREF:
if (kid->op_type == OP_CONST &&
}
}
/* if treating as a reference, defer additional checks to runtime */
- return o->op_type == ref_type ? o : ck_fun(o);
+ if (o->op_type == ref_type) {
+ /* diag_listed_as: keys on reference is experimental */
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_EXPERIMENTAL__AGGREF),
+ "%s is experimental", PL_op_desc[ref_type]);
+ return o;
+ }
+ return ck_fun(o);
}
OP *
(W unpack) You have applied the same modifier more than once after a
type in a pack template. See L<perlfunc/pack>.
+=item each on reference is experimental
+
+(S experimental::aggref) C<each> with a scalar argument is experimental and
+may change or be removed in a future Perl version. If you want to take
+the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item elseif should be elsif
(S syntax) There is no keyword "elseif" in Perl because Larry thinks
(P) The regular expression parser is confused.
+=item keys on reference is experimental
+
+(S experimental::aggref) C<keys> with a scalar argument is experimental and
+may change or be removed in a future Perl version. If you want to take
+the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item Label not found for "last %s"
(F) You named a loop to break out of, but you're not currently in a loop
(F) The unpack format P must have an explicit size, not "*".
-=item POSIX class [:%s:] unknown in regex; marked by S<<-- HERE> in m/%s/
+=item pop on reference is experimental
+
+(S experimental::aggref) C<pop> with a scalar argument is experimental and
+may change or be removed in a future Perl version. If you want to take
+the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
+=item POSIX class [:%s:] unknown in regex; marked by S<< <-- HERE in m/%s/ >>
(F) The class in the character class [: :] syntax is unknown. The S<<-- HERE>
shows whereabouts in the regular expression the problem was discovered.
case of that character is not in Latin1, in that locale it doesn't
change when upper cased.
-=item Quantifier follows nothing in regex; marked by S<<-- HERE> in m/%s/
+=item push on reference is experimental
+
+(S experimental::aggref) C<push> with a scalar argument is experimental and
+may change or be removed in a future Perl version. If you want to take
+the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
+=item Quantifier follows nothing in regex; marked by S<< <-- HERE in m/%s/ >>
(F) You started a regular expression with a quantifier. Backslash it if
you meant it literally. The S<<-- HERE> shows whereabouts in the regular
forget to check the return value of your socket() call? See
L<perlfunc/setsockopt>.
+=item shift on reference is experimental
+
+(S experimental::aggref) C<shift> with a scalar argument is experimental
+and may change or be removed in a future Perl version. If you want to
+take the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item shm%s not implemented
(F) You don't have System V shared memory IPC on your system.
try explicitly pre-extending the array by assigning $#array = $offset.
See L<perlfunc/splice>.
+=item splice on reference is experimental
+
+(S experimental::aggref) C<splice> with a scalar argument is experimental
+and may change or be removed in a future Perl version. If you want to
+take the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item Split loop
(P) The split was looping infinitely. (Obviously, a split shouldn't
think you didn't do that, check the #! line to see if it's supplying the
bad switch on your behalf.)
+=item unshift on reference is experimental
+
+(S experimental::aggref) C<unshift> with a scalar argument is experimental
+and may change or be removed in a future Perl version. If you want to
+take the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item Unsuccessful %s on filename containing newline
(W newline) A file operation was attempted on a filename, and that
longer than 1024 characters. The return value has been truncated to
1024 characters.
+=item values on reference is experimental
+
+(S experimental::aggref) C<values> with a scalar argument is experimental
+and may change or be removed in a future Perl version. If you want to
+take the risk of using this feature, simply disable this warning:
+
+ no warnings "experimental::aggref";
+
=item Variable "%s" is not available
(W closure) During compilation, an inner named subroutine or eval is
|
+- experimental --+
| |
+ | +- experimental::aggref
+ | |
| +- experimental::lexical_subs
| |
| +- experimental::lexical_topic
use 5.008;
use warnings;
use warnings FATAL => 'all';
+no warnings 'experimental::aggref';
use Text::Wrap qw(wrap);
use Data::Dumper;
$Data::Dumper::Useqq= 1;
[ 5.017, DEFAULT_ON ],
'experimental::postderef' =>
[ 5.019, DEFAULT_ON ],
+ 'experimental::aggref' =>
+ [ 5.019, DEFAULT_ON ],
}],
#'default' => [ 5.008, DEFAULT_ON ],
Array @%s missing the @ in argument %d of %s()
push fred ;
+ push on reference is experimental [ck_fun]
+ pop on reference is experimental
+ shift on reference is experimental
+ unshift on reference is experimental
+ splice on reference is experimental
+
Hash %%%s missing the %% in argument %d of %s()
keys joe ;
$[ used in comparison (did you mean $] ?)
+ each on reference is experimental [ck_each]
+ keys on reference is experimental
+ values on reference is experimental
+
length() used on @array (did you mean "scalar(@array)"?)
length() used on %hash (did you mean "scalar(keys %hash)"?)
@h{localtime 0};
@h{gmtime 0};
@h{eval ""};
-@h{each $foo} if 0;
-@h{keys $foo} if 0;
-@h{values $foo} if 0;
+{
+ no warnings 'experimental::aggref';
+ @h{each $foo} if 0;
+ @h{keys $foo} if 0;
+ @h{values $foo} if 0;
+}
# arrays
@h[qw"a b c"] = 1..3;
@h[localtime 0];
@h[gmtime 0];
@h[eval ""];
-@h[each $foo] if 0;
-@h[keys $foo] if 0;
-@h[values $foo] if 0;
+{
+ no warnings 'experimental::aggref';
+ @h[each $foo] if 0;
+ @h[keys $foo] if 0;
+ @h[values $foo] if 0;
+}
EXPECT
########
# op.c
Array @FRED missing the @ in argument 1 of push() at - line 2.
########
# op.c
+$fred = [];
+push $fred;
+pop $fred;
+shift $fred;
+unshift $fred;
+splice $fred;
+no warnings 'deprecated' ;
+push $fred;
+pop $fred;
+shift $fred;
+unshift $fred;
+splice $fred;
+EXPECT
+push on reference is experimental at - line 3.
+pop on reference is experimental at - line 4.
+shift on reference is experimental at - line 5.
+unshift on reference is experimental at - line 6.
+splice on reference is experimental at - line 7.
+########
+# op.c
@a = keys FRED ;
no warnings 'deprecated' ;
@a = keys FRED ;
$[ used in numeric le (<=) (did you mean $] ?) at - line 19.
$[ used in numeric ge (>=) (did you mean $] ?) at - line 20.
########
+# op.c [Perl_ck_each]
+$fred = {};
+keys $fred;
+values $fred;
+each $fred;
+no warnings 'deprecated' ;
+keys $fred;
+values $fred;
+each $fred;
+EXPECT
+keys on reference is experimental at - line 3.
+values on reference is experimental at - line 4.
+each on reference is experimental at - line 5.
+########
# op.c [Perl_ck_length]
use warnings 'syntax' ;
length(@a);
{
my %h = 'a'..'b';
my @i = \%h;
- no warnings 'syntax';
+ no warnings 'syntax', 'experimental::aggref';
my ($k,$v) = each %i[0];
is $k, 'a', 'key returned by each %array[ix]';
is $v, 'b', 'val returned by each %array[ix]';
{
my %h = 'a'..'b';
my %i = (foo => \%h);
- no warnings 'syntax';
+ no warnings 'syntax', 'experimental::aggref';
my ($k,$v) = each %i{foo=>};
is $k, 'a', 'key returned by each %hash{key}';
is $v, 'b', 'val returned by each %hash{key}';
}
is( join(':',@x), '1:2:3:1:2:3:4', 'pop intuiting @ on array');
+no warnings 'experimental::aggref';
+
# test for push/pop on arrayref
push(\@x,5);
is( join(':',@x), '1:2:3:1:2:3:4:5', 'push arrayref');
}
use strict;
use warnings;
-no warnings 'deprecated';
+no warnings 'deprecated', 'experimental::aggref';
use vars qw($data $array $values $hash $errpat);
plan 'no_plan';
ok( !oo->isa('Bar'), 'splice @ISA and make Foo a Bar');
# Test undef first arg
-eval { splice( $new_arrayref, 0, 0, 1, 2, 3 ) };
+eval { no warnings 'experimental';splice( $new_arrayref, 0, 0, 1, 2, 3 ) };
like($@, qr/Not an ARRAY/, 'undefined first argument to splice');
# Test arrays with nonexistent elements (crashes when it fails)
$dummy = $$var1 ; check_count '${}';
tie my $var2 => 'main', [];
$dummy = @$var2 ; check_count '@{}';
-$dummy = shift $var2 ; check_count 'shift arrayref';
+{
+ no warnings 'experimental::aggref';
+ $dummy = shift $var2 ; check_count 'shift arrayref';
+}
tie my $var3 => 'main', {};
$dummy = %$var3 ; check_count '%{}';
-$dummy = keys $var3 ; check_count 'keys hashref';
+{
+ no warnings 'experimental::aggref';
+ $dummy = keys $var3 ; check_count 'keys hashref';
+}
{
no strict 'refs';
tie my $var4 => 'main', *];
@array = (1, 2, 3);
$aref = [1, 2, 3];
+no warnings 'experimental::aggref';
{
no warnings 'syntax';
$count3 = unshift (@array);
/* Warnings Categories added in Perl 5.019 */
-#define WARN_EXPERIMENTAL__POSTDEREF 56
-#define WARN_SYSCALLS 57
+#define WARN_EXPERIMENTAL__AGGREF 56
+#define WARN_EXPERIMENTAL__POSTDEREF 57
+#define WARN_SYSCALLS 58
#define WARNsize 15
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"