From 11e707376efcf719cd58654ad31765e405a9778d Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Thu, 1 Mar 2018 22:46:25 +0000 Subject: [PATCH 1/3] Deprecate conj(::Any), add real(::Missing) and imag(::Missing) --- base/deprecated.jl | 3 +++ base/missing.jl | 4 ++-- base/operators.jl | 4 +--- test/missing.jl | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index 44a0107d9f65c..cfae8fd199a38 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1477,6 +1477,9 @@ function assert(x) @assert x "" end +# Issue #26248 +@deprecate conj(x) x + # END 0.7 deprecations # BEGIN 1.0 deprecations diff --git a/base/missing.jl b/base/missing.jl index 3c4b3760d623b..c53084b7d21ab 100644 --- a/base/missing.jl +++ b/base/missing.jl @@ -64,14 +64,14 @@ isless(::Any, ::Missing) = true # Unary operators/functions for f in (:(!), :(~), :(+), :(-), :(identity), :(zero), :(one), :(oneunit), - :(abs), :(abs2), :(sign), + :(abs), :(abs2), :(sign), :(real), :(imag), :(acos), :(acosh), :(asin), :(asinh), :(atan), :(atanh), :(sin), :(sinh), :(cos), :(cosh), :(tan), :(tanh), :(exp), :(exp2), :(expm1), :(log), :(log10), :(log1p), :(log2), :(exponent), :(sqrt), :(gamma), :(lgamma), :(iseven), :(ispow2), :(isfinite), :(isinf), :(isodd), :(isinteger), :(isreal), :(isnan), :(isempty), - :(iszero), :(transpose), :(float)) + :(iszero), :(transpose), :(float), :(conj)) @eval Math.$(f)(::Missing) = missing end diff --git a/base/operators.jl b/base/operators.jl index 1ec7d76bad003..9a2de77d0fb0d 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -733,8 +733,6 @@ See also: [`fld1`](@ref), [`mod1`](@ref). """ fldmod1(x, y) = (fld1(x, y), mod1(x, y)) -conj(x) = x - """ widen(x) @@ -874,4 +872,4 @@ julia> map(splat(+), zip(1:3,4:6)) 9 ``` """ -splat(f) = args->f(args...) \ No newline at end of file +splat(f) = args->f(args...) diff --git a/test/missing.jl b/test/missing.jl index d1b13fc5922a5..7585fc9c892b7 100644 --- a/test/missing.jl +++ b/test/missing.jl @@ -142,7 +142,7 @@ Base.zero(::Type{Unit}) = Unit(0) Base.one(::Type{Unit}) = 1 @testset "elementary functions" begin - elementary_functions = [abs, abs2, sign, + elementary_functions = [abs, abs2, sign, real, imag, acos, acosh, asin, asinh, atan, atanh, sin, sinh, conj, cos, cosh, tan, tanh, exp, exp2, expm1, log, log10, log1p, log2, From 20ac940376ef7bf5e77507c9ea835566ba77cba2 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Fri, 2 Mar 2018 08:43:52 +0000 Subject: [PATCH 2/3] fic lin alg test --- stdlib/LinearAlgebra/test/generic.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/LinearAlgebra/test/generic.jl b/stdlib/LinearAlgebra/test/generic.jl index 00a560af9be51..cd44f36a96ab4 100644 --- a/stdlib/LinearAlgebra/test/generic.jl +++ b/stdlib/LinearAlgebra/test/generic.jl @@ -335,6 +335,7 @@ Base.zero(::Type{ModInt{n}}) where {n} = ModInt{n}(0) Base.zero(::ModInt{n}) where {n} = ModInt{n}(0) Base.one(::Type{ModInt{n}}) where {n} = ModInt{n}(1) Base.one(::ModInt{n}) where {n} = ModInt{n}(1) +Base.conj(a::ModInt{n}) where {n} = a Base.adjoint(a::ModInt{n}) where {n} = ModInt{n}(conj(a)) Base.transpose(a::ModInt{n}) where {n} = a # see Issue 20978 LinearAlgebra.Adjoint(a::ModInt{n}) where {n} = adjoint(a) From 8e3cdf305cd11ff813780f996fbbac3a83fe138e Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Fri, 2 Mar 2018 12:11:17 +0100 Subject: [PATCH 3/3] Fix rebase --- base/missing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/missing.jl b/base/missing.jl index 10ed12415b9da..7ca2c9373bbf1 100644 --- a/base/missing.jl +++ b/base/missing.jl @@ -72,7 +72,7 @@ for f in (:(!), :(~), :(+), :(-), :(identity), :(zero), :(one), :(oneunit), :(iseven), :(ispow2), :(isfinite), :(isinf), :(isodd), :(isinteger), :(isreal), :(isnan), :(isempty), :(iszero), :(transpose), :(adjoint), :(float), :(conj)) - @eval Math.$(f)(::Missing) = missing + @eval $(f)(::Missing) = missing end for f in (:(Base.zero), :(Base.one), :(Base.oneunit))