Skip to content

Commit 5db9e74

Browse files
quinnjararslan
authored andcommitted
Add adjoint(::Missing) method
1 parent 7188305 commit 5db9e74

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

base/missing.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ for f in (:(!), :(~), :(+), :(-), :(identity), :(zero), :(one), :(oneunit),
6868
:(acos), :(acosh), :(asin), :(asinh), :(atan), :(atanh),
6969
:(sin), :(sinh), :(cos), :(cosh), :(tan), :(tanh),
7070
:(exp), :(exp2), :(expm1), :(log), :(log10), :(log1p),
71-
:(log2), :(exponent), :(sqrt), :(gamma), :(lgamma),
71+
:(log2), :(Math.exponent), :(sqrt), :(Math.gamma), :(Math.lgamma),
7272
:(iseven), :(ispow2), :(isfinite), :(isinf), :(isodd),
7373
:(isinteger), :(isreal), :(isnan), :(isempty),
74-
:(iszero), :(transpose), :(float))
75-
@eval Math.$(f)(::Missing) = missing
74+
:(iszero), :(transpose), :(adjoint), :(float))
75+
@eval $(f)(::Missing) = missing
7676
end
7777

7878
for f in (:(Base.zero), :(Base.one), :(Base.oneunit))

test/missing.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Base.one(::Type{Unit}) = 1
150150
identity, zero, one, oneunit,
151151
iseven, isodd, ispow2,
152152
isfinite, isinf, isnan, iszero,
153-
isinteger, isreal, isempty, transpose, float]
153+
isinteger, isreal, isempty, transpose, adjoint, float]
154154

155155
# All elementary functions return missing when evaluating missing
156156
for f in elementary_functions
@@ -218,6 +218,7 @@ end
218218
x = convert(Vector{Union{Int, Missing}}, [missing])
219219
@test isa(x, Vector{Union{Int, Missing}})
220220
@test isequal(x, [missing])
221+
@test eltype(adjoint([1, missing])) == Union{Int, Missing}
221222
end
222223

223224
@testset "== and != on arrays" begin

0 commit comments

Comments
 (0)