Skip to content

Commit

Permalink
break some dependency backedges
Browse files Browse the repository at this point in the history
This would be nicer if we had function types,
but this tries to at least hit a couple of the high points

fix #20780
  • Loading branch information
vtjnash committed Mar 1, 2017
1 parent 0cebddf commit 1e9c658
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ end
# Deprecate vectorized !
@deprecate(!(A::AbstractArray{Bool}), .!A) # parens for #20541
@deprecate(!(B::BitArray), .!B) # parens for #20541
!(::typeof(()->())) = () # make sure ! has at least 4 methods so that for-loops don't end up getting a back-edge to depwarn

# Deprecate vectorized ~
@deprecate ~(A::AbstractArray) .~A
Expand Down
18 changes: 11 additions & 7 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ false
"""
isequal(x, y) = x == y

isequal(x::AbstractFloat, y::AbstractFloat) = (isnan(x) & isnan(y)) | (signbit(x) == signbit(y)) & (x == y)
isequal(x::Real, y::AbstractFloat) = (isnan(x) & isnan(y)) | (signbit(x) == signbit(y)) & (x == y)
isequal(x::AbstractFloat, y::Real ) = (isnan(x) & isnan(y)) | (signbit(x) == signbit(y)) & (x == y)
signequal(x, y) = signbit(x)::Bool == signbit(y)::Bool
signless(x, y) = signbit(x)::Bool & !signbit(y)::Bool

isequal(x::AbstractFloat, y::AbstractFloat) = (isnan(x) & isnan(y)) | signequal(x, y) & (x == y)
isequal(x::Real, y::AbstractFloat) = (isnan(x) & isnan(y)) | signequal(x, y) & (x == y)
isequal(x::AbstractFloat, y::Real ) = (isnan(x) & isnan(y)) | signequal(x, y) & (x == y)

isless(x::AbstractFloat, y::AbstractFloat) = (!isnan(x) & isnan(y)) | signless(x, y) | (x < y)
isless(x::Real, y::AbstractFloat) = (!isnan(x) & isnan(y)) | signless(x, y) | (x < y)
isless(x::AbstractFloat, y::Real ) = (!isnan(x) & isnan(y)) | signless(x, y) | (x < y)

isless(x::AbstractFloat, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)
isless(x::Real, y::AbstractFloat) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)
isless(x::AbstractFloat, y::Real ) = (!isnan(x) & isnan(y)) | (signbit(x) & !signbit(y)) | (x < y)

function ==(T::Type, S::Type)
@_pure_meta
Expand Down Expand Up @@ -122,7 +126,7 @@ julia> "foo" ≠ "foo"
false
```
"""
!=(x, y) = !(x == y)
!=(x, y) = !(x == y)::Bool
const = !=

"""
Expand Down
10 changes: 5 additions & 5 deletions base/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ muladd(x::Number, y::Number, z::Number) = muladd(promote(x,y,z)...)
(|)(x::Integer, y::Integer) = (|)(promote(x,y)...)
xor(x::Integer, y::Integer) = xor(promote(x,y)...)

==(x::Number, y::Number) = (==)(promote(x,y)...)
<( x::Real, y::Real) = (< )(promote(x,y)...)
<=(x::Real, y::Real) = (<=)(promote(x,y)...)
==(x::Number, y::Number) = (==)(promote(x,y)...)::Bool
<( x::Real, y::Real) = (< )(promote(x,y)...)::Bool
<=(x::Real, y::Real) = (<=)(promote(x,y)...)::Bool

div(x::Real, y::Real) = div(promote(x,y)...)
fld(x::Real, y::Real) = fld(promote(x,y)...)
Expand Down Expand Up @@ -352,6 +352,6 @@ min(x::Real) = x
max(x::Real) = x
minmax(x::Real) = (x, x)

max{T<:Real}(x::T, y::T) = ifelse(y < x, x, y)
min{T<:Real}(x::T, y::T) = ifelse(y < x, y, x)
max{T<:Real}(x::T, y::T) = select_value(y < x, x, y)
min{T<:Real}(x::T, y::T) = select_value(y < x, y, x)
minmax{T<:Real}(x::T, y::T) = y < x ? (y, x) : (x, y)

0 comments on commit 1e9c658

Please sign in to comment.