Skip to content

Commit

Permalink
Fix some Perl ambiguity warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Oct 18, 2018
1 parent ff6bab9 commit c023c73
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 55 deletions.
12 changes: 6 additions & 6 deletions lib/Sidef/Types/Array/Array.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3220,26 +3220,26 @@ package Sidef::Types::Array::Array {
*{__PACKAGE__ . '::' . '*'} = \&mul;
*{__PACKAGE__ . '::' . '**'} = \&mpow;
*{__PACKAGE__ . '::' . '<<'} = \&append;
*{__PACKAGE__ . '::' . '«'} = \&append;
*{__PACKAGE__ . '::' . '«'} = \&append;
*{__PACKAGE__ . '::' . '>>'} = \&assign_to;
*{__PACKAGE__ . '::' . '»'} = \&assign_to;
*{__PACKAGE__ . '::' . '»'} = \&assign_to;
*{__PACKAGE__ . '::' . '|'} = \&or;
*{__PACKAGE__ . '::' . '^'} = \&xor;
*{__PACKAGE__ . '::' . '+'} = \&add;
*{__PACKAGE__ . '::' . '-'} = \&sub;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . '<'} = \&lt;
*{__PACKAGE__ . '::' . '<='} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . '>'} = \&gt;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . '>='} = \&ge;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . '<=>'} = \&cmp;
*{__PACKAGE__ . '::' . ':'} = \&pair_with;
*{__PACKAGE__ . '::' . '/'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '...'} = \&to_list;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Sidef/Types/Array/Matrix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ package Sidef::Types::Array::Matrix {
*{__PACKAGE__ . '::' . '+'} = \&add;
*{__PACKAGE__ . '::' . '-'} = \&sub;
*{__PACKAGE__ . '::' . '/'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/Sidef/Types/Glob/FileHandle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ package Sidef::Types::Glob::FileHandle {
{
no strict 'refs';
*{__PACKAGE__ . '::' . '>>'} = \&read_to;
*{__PACKAGE__ . '::' . '»'} = \&read_to;
*{__PACKAGE__ . '::' . '»'} = \&read_to;
*{__PACKAGE__ . '::' . '<<'} = \&write_from;
*{__PACKAGE__ . '::' . '«'} = \&write_from;
*{__PACKAGE__ . '::' . '«'} = \&write_from;
}

};
Expand Down
2 changes: 1 addition & 1 deletion lib/Sidef/Types/Hash/Hash.pm
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ package Sidef::Types::Hash::Hash {
*{__PACKAGE__ . '::' . '+'} = \&concat;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ':'} = \&new;
*{__PACKAGE__ . '::' . '...'} = \&to_list;
}
Expand Down
34 changes: 17 additions & 17 deletions lib/Sidef/Types/Number/Number.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9117,7 +9117,7 @@ package Sidef::Types::Number::Number {
@factors{Math::Prime::Util::GMP::factor($n)} = ();

my @d;
foreach my $p (sort { (length($a) <=> length($b)) || ($a cmp $b) } keys %factors) {
foreach my $p (sort { (CORE::length($a) <=> CORE::length($b)) || ($a cmp $b) } keys %factors) {
push @d,
(
$p < ULONG_MAX
Expand All @@ -9138,7 +9138,7 @@ package Sidef::Types::Number::Number {
my @factors = grep { $factors{$_} == 1 } keys %factors;

my @d;
foreach my $p (sort { (length($a) <=> length($b)) || ($a cmp $b) } @factors) {
foreach my $p (sort { (CORE::length($a) <=> CORE::length($b)) || ($a cmp $b) } @factors) {
push @d,
(
$p < ULONG_MAX
Expand Down Expand Up @@ -10987,7 +10987,7 @@ package Sidef::Types::Number::Number {
no strict 'refs';

*{__PACKAGE__ . '::' . '/'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '*'} = \&mul;
*{__PACKAGE__ . '::' . '+'} = \&add;
*{__PACKAGE__ . '::' . '-'} = \&sub;
Expand All @@ -11002,12 +11002,12 @@ package Sidef::Types::Number::Number {
*{__PACKAGE__ . '::' . '^'} = \&xor;
*{__PACKAGE__ . '::' . '<=>'} = \&cmp;
*{__PACKAGE__ . '::' . '<='} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . '>='} = \&ge;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . '..'} = \&to;
*{__PACKAGE__ . '::' . '..^'} = \&xto;
*{__PACKAGE__ . '::' . '^..'} = \&xdownto;
Expand All @@ -11019,18 +11019,18 @@ package Sidef::Types::Number::Number {
*{__PACKAGE__ . '::' . '~'} = \&not;
*{__PACKAGE__ . '::' . ':'} = \&pair;
*{__PACKAGE__ . '::' . '//'} = \&idiv;
*{__PACKAGE__ . '::' . 'γ'} = \&EulerGamma;
*{__PACKAGE__ . '::' . 'Γ'} = \&gamma;
*{__PACKAGE__ . '::' . 'Ψ'} = \&digamma;
*{__PACKAGE__ . '::' . 'ϕ'} = \&euler_totient;
*{__PACKAGE__ . '::' . 'σ'} = \&sigma;
*{__PACKAGE__ . '::' . 'Ω'} = \&big_omega;
*{__PACKAGE__ . '::' . 'ω'} = \&omega;
*{__PACKAGE__ . '::' . 'ζ'} = \&zeta;
*{__PACKAGE__ . '::' . 'η'} = \&eta;
*{__PACKAGE__ . '::' . 'μ'} = \&moebius;
*{__PACKAGE__ . '::' . 'γ'} = \&EulerGamma;
*{__PACKAGE__ . '::' . 'Γ'} = \&gamma;
*{__PACKAGE__ . '::' . 'Ψ'} = \&digamma;
*{__PACKAGE__ . '::' . 'ϕ'} = \&euler_totient;
*{__PACKAGE__ . '::' . 'σ'} = \&sigma;
*{__PACKAGE__ . '::' . 'Ω'} = \&big_omega;
*{__PACKAGE__ . '::' . 'ω'} = \&omega;
*{__PACKAGE__ . '::' . 'ζ'} = \&zeta;
*{__PACKAGE__ . '::' . 'η'} = \&eta;
*{__PACKAGE__ . '::' . 'μ'} = \&moebius;
*{__PACKAGE__ . '::' . '=~='} = \&approx_eq;
*{__PACKAGE__ . '::' . ''} = \&approx_eq;
*{__PACKAGE__ . '::' . ''} = \&approx_eq;

*{__PACKAGE__ . '::' . 'Möbius'} = \&moebius;
*{__PACKAGE__ . '::' . 'möbius'} = \&moebius;
Expand Down
4 changes: 2 additions & 2 deletions lib/Sidef/Types/Range/Range.pm
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,10 @@ package Sidef::Types::Range::Range {
*{__PACKAGE__ . '::' . '-'} = \&sub;
*{__PACKAGE__ . '::' . '*'} = \&mul;
*{__PACKAGE__ . '::' . '/'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . '...'} = \&to_list;
}

Expand Down
26 changes: 14 additions & 12 deletions lib/Sidef/Types/Set/Bag.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ package Sidef::Types::Set::Bag {

my $refaddr = Scalar::Util::refaddr($obj);

exists($addr{$refaddr})
CORE::exists($addr{$refaddr})
&& return $addr{$refaddr};

my @bag;
Expand Down Expand Up @@ -620,6 +620,8 @@ package Sidef::Types::Set::Bag {
: (Sidef::Types::Bool::Bool::FALSE);
}

*exists = \&has;

sub is_subset {
my ($A, $B) = @_;

Expand Down Expand Up @@ -778,15 +780,15 @@ package Sidef::Types::Set::Bag {

my $refaddr = Scalar::Util::refaddr($obj);

exists($addr{$refaddr})
CORE::exists($addr{$refaddr})
and return $addr{$refaddr};

my @values = CORE::values(%$obj);

$addr{$refaddr} = "Bag(#`($refaddr)...)";

my ($s, $v);
"Bag(" . join(
"Bag(" . CORE::join(
', ',
map {
((ref($v = $_->{value}) && ($s = UNIVERSAL::can($v, 'dump'))) ? $s->($v) : ($v // 'nil')) x $_->{count}
Expand All @@ -807,23 +809,23 @@ package Sidef::Types::Set::Bag {
no strict 'refs';

*{__PACKAGE__ . '::' . '+'} = \&concat;
*{__PACKAGE__ . '::' . ''} = \&union;
*{__PACKAGE__ . '::' . ''} = \&union;
*{__PACKAGE__ . '::' . '|'} = \&union;
*{__PACKAGE__ . '::' . '&'} = \&intersection;
*{__PACKAGE__ . '::' . ''} = \&intersection;
*{__PACKAGE__ . '::' . ''} = \&intersection;
*{__PACKAGE__ . '::' . '-'} = \&difference;
*{__PACKAGE__ . '::' . ''} = \&difference;
*{__PACKAGE__ . '::' . ''} = \&difference;
*{__PACKAGE__ . '::' . '^'} = \&symmetric_difference;
*{__PACKAGE__ . '::' . '<='} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . '>='} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . '...'} = \&to_list;
*{__PACKAGE__ . '::' . ''} = \&eq;
*{__PACKAGE__ . '::' . ''} = \&eq;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . '<<'} = \&append;
}
Expand Down
19 changes: 10 additions & 9 deletions lib/Sidef/Types/Set/Set.pm
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ package Sidef::Types::Set::Set {

my $s;
"Set("
. join(', ', map { (ref($_) && ($s = UNIVERSAL::can($_, 'dump'))) ? $s->($_) : ($_ // 'nil') } @values) . ')';
. CORE::join(', ', map { (ref($_) && ($s = UNIVERSAL::can($_, 'dump'))) ? $s->($_) : ($_ // 'nil') } @values)
. ')';
};

local *Sidef::Types::Set::Set::dump = $sub;
Expand Down Expand Up @@ -416,21 +417,21 @@ package Sidef::Types::Set::Set {

*{__PACKAGE__ . '::' . '+'} = \&concat;
*{__PACKAGE__ . '::' . '<<'} = \&append;
*{__PACKAGE__ . '::' . ''} = \&union;
*{__PACKAGE__ . '::' . ''} = \&union;
*{__PACKAGE__ . '::' . '|'} = \&union;
*{__PACKAGE__ . '::' . '&'} = \&intersection;
*{__PACKAGE__ . '::' . ''} = \&intersection;
*{__PACKAGE__ . '::' . ''} = \&intersection;
*{__PACKAGE__ . '::' . '-'} = \&difference;
*{__PACKAGE__ . '::' . ''} = \&difference;
*{__PACKAGE__ . '::' . ''} = \&difference;
*{__PACKAGE__ . '::' . '^'} = \&symmetric_difference;
*{__PACKAGE__ . '::' . '<='} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . '>='} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . ''} = \&is_subset;
*{__PACKAGE__ . '::' . ''} = \&is_superset;
*{__PACKAGE__ . '::' . '...'} = \&to_list;
*{__PACKAGE__ . '::' . ''} = \&Sidef::Types::Hash::Hash::eq;
*{__PACKAGE__ . '::' . ''} = \&Sidef::Types::Hash::Hash::eq;
}
};

Expand Down
8 changes: 4 additions & 4 deletions lib/Sidef/Types/String/String.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1503,15 +1503,15 @@ package Sidef::Types::String::String {
*{__PACKAGE__ . '::' . '-'} = \&diff;
*{__PACKAGE__ . '::' . '=='} = \&eq;
*{__PACKAGE__ . '::' . '!='} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . ''} = \&ne;
*{__PACKAGE__ . '::' . '>'} = \&gt;
*{__PACKAGE__ . '::' . '<'} = \&lt;
*{__PACKAGE__ . '::' . '>='} = \&ge;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . ''} = \&ge;
*{__PACKAGE__ . '::' . '<='} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . ''} = \&le;
*{__PACKAGE__ . '::' . '<=>'} = \&cmp;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '÷'} = \&div;
*{__PACKAGE__ . '::' . '/'} = \&div;
*{__PACKAGE__ . '::' . '..'} = \&to;
*{__PACKAGE__ . '::' . '^'} = \&xor;
Expand Down
2 changes: 1 addition & 1 deletion utils/auto_perltidy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

alias perltidy='perltidy -l=127 -f -kbl=1 -bbb -bbc -bbs -b -ple -bt=2 -pt=2 -sbt=2 -bvt=0 -sbvt=1 -cti=1 -bar -lp -anl';
alias perltidy='perltidy -utf8 -l=127 -f -kbl=1 -bbb -bbc -bbs -b -ple -bt=2 -pt=2 -sbt=2 -bvt=0 -sbvt=1 -cti=1 -bar -lp -anl';
which perltidy;
cd ..;
for i in $(git status | grep '^[[:cntrl:]]*modified:' | egrep '(\.(t|pm)|sidef)$' | perl -nE 'say +(split)[-1]'); do echo $i; perltidy -b $i; done

0 comments on commit c023c73

Please sign in to comment.