Skip to content

Commit

Permalink
Added unary plus for Complex{Bool}
Browse files Browse the repository at this point in the history
  • Loading branch information
eulerkochy committed Feb 18, 2019
1 parent dfee945 commit 4e22ff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ muladd(z::Complex, w::Complex, x::Complex) =
Complex(muladd(real(z), real(w), real(x)) - imag(z)*imag(w), # TODO: use mulsub given #15985
muladd(real(z), imag(w), muladd(imag(z), real(w), imag(x))))

#unary + handling Complex{Bool}

+(z::Complex{Bool}) = Complex(convert(Int,z))

# handle Bool and Complex{Bool}
# avoid type signature ambiguity warnings
+(x::Bool, z::Complex{Bool}) = Complex(x + real(z), imag(z))
Expand Down

0 comments on commit 4e22ff4

Please sign in to comment.