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
|
builtin.c experimental warnings from builtin functions
__END__
# builtin.c - booleans
use strict;
use warnings qw(all -void);
use builtin qw(is_bool true false);
my ($is_bool, $true, $false) = (\&is_bool, \&true, \&false);
is_bool(0);
true;
false;
&is_bool(0);
&true;
&false;
$is_bool->(0);
$true->();
$false->();
no warnings 'experimental::builtin';
is_bool(0);
true;
false;
&is_bool(0);
&true;
&false;
$is_bool->(0);
$true->();
$false->();
EXPECT
Built-in function 'builtin::is_bool' is experimental at - line 6.
Built-in function 'builtin::is_bool' is experimental at - line 9.
Built-in function 'builtin::is_bool' is experimental at - line 12.
########
# builtin.c - weakrefs
use strict;
use warnings qw(all -void);
use builtin qw(weaken unweaken is_weak);
my ($weaken, $unweaken, $is_weak) = (\&weaken, \&unweaken, \&is_weak);
my $ref = [];
is_weak($ref);
weaken($ref);
unweaken($ref);
&is_weak($ref);
&weaken($ref);
&unweaken($ref);
$is_weak->($ref);
$weaken->($ref);
$unweaken->($ref);
no warnings 'experimental::builtin';
is_weak($ref);
weaken($ref);
unweaken($ref);
&is_weak($ref);
&weaken($ref);
&unweaken($ref);
$is_weak->($ref);
$weaken->($ref);
$unweaken->($ref);
EXPECT
########
# builtin.c - blessed refs
use strict;
use warnings qw(all -void);
use builtin qw(blessed refaddr reftype);
my ($blessed, $refaddr, $reftype) = (\&blessed, \&refaddr, \&reftype);
my $ref = [];
blessed($ref);
refaddr($ref);
reftype($ref);
&blessed($ref);
&refaddr($ref);
&reftype($ref);
$blessed->($ref);
$refaddr->($ref);
$reftype->($ref);
no warnings 'experimental::builtin';
blessed($ref);
refaddr($ref);
reftype($ref);
&blessed($ref);
&refaddr($ref);
&reftype($ref);
$blessed->($ref);
$refaddr->($ref);
$reftype->($ref);
EXPECT
########
# builtin.c - indexed
use strict;
use warnings qw(all);
use builtin qw(indexed);
my @array = indexed 1..3;
my $scalar = indexed 1..3;
indexed 1..3;
EXPECT
Useless use of builtin::indexed in scalar context at - line 6.
Useless use of builtin::indexed in void context at - line 7.
########
# builtin.c - import from bundles is idempotent
use builtin qw(true false);
use builtin ':5.39';
use builtin ':5.39';
EXPECT
|