Skip to content

Commit

Permalink
Merge pull request #51 from jump-dev/bl/_iszero
Browse files Browse the repository at this point in the history
Remove _iszero hack on Julia nightly
  • Loading branch information
blegat authored Jun 17, 2020
2 parents 3ccef82 + f0903d1 commit 0f238a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ matrix:
fast_finish: true
notifications:
email: false
after_success:
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'
jobs:
include:
- stage: Documentation
Expand Down
19 changes: 12 additions & 7 deletions src/dispatch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,17 @@ function Matrix(A::LinearAlgebra.Hermitian{<:AbstractMutable})
return B
end

# Called in `getindex` of `LinearAlgebra.LowerTriangular` and `LinearAlgebra.UpperTriangular`.
# Called in `getindex` of `LinearAlgebra.LowerTriangular` and `LinearAlgebra.UpperTriangular`
# as the elements may be `Array` for which `zero` is only defined for instances but not for the type.
# For `AbstractMutable` we assume that `zero` for the instance is the same than for the type by default.
Base.zero(x::AbstractMutable) = zero(typeof(x))

# To determine whether the funtion is zero preserving, `LinearAlgebra` calls
# `zero` on the `eltype` of the broadcasted object and then check `_iszero`.
# `_iszero(x)` redirects to `iszero(x)` for numbers and to `x == 0` otherwise.
# `x == 0` returns false for types that implement `iszero` but not `==` such as
# `DummyBigInt` and MOI functions.
LinearAlgebra._iszero(x::AbstractMutable) = iszero(x)
# This was fixed in https://github.com/JuliaLang/julia/pull/36194
if VERSION < v"1.6.0-DEV.216"
# To determine whether the funtion is zero preserving, `LinearAlgebra` calls
# `zero` on the `eltype` of the broadcasted object and then check `_iszero`.
# `_iszero(x)` redirects to `iszero(x)` for numbers and to `x == 0` otherwise.
# `x == 0` returns false for types that implement `iszero` but not `==` such as
# `DummyBigInt` and MOI functions.
LinearAlgebra._iszero(x::AbstractMutable) = iszero(x)
end

0 comments on commit 0f238a7

Please sign in to comment.