@@ -100,19 +100,13 @@ for f in (:(!), :(~), :(+), :(-), :(*), :(&), :(|), :(xor),
100100 :(real), :(imag), :(sign), :(inv))
101101 @eval ($ f)(:: Missing ) = missing
102102end
103- for f in (:(Base. zero), :(Base. one), :(Base. oneunit))
104- @eval ($ f)(:: Type{Missing} ) = missing
105- @eval function $ (f)(:: Type{Union{T, Missing}} ) where T
106- T === Any && throw (MethodError ($ f, (Any,))) # To prevent StackOverflowError
107- $ f (T)
108- end
103+ for f in (:zero , :one , :oneunit )
104+ @eval ($ f)(:: Type{Any} ) = throw (MethodError ($ f, (Any,))) # To prevent StackOverflowError
105+ @eval ($ f)(:: Type{T} ) where {T>: Missing } = $ f (nonmissingtype_checked (T))
109106end
110- for f in (:(Base. float), :(Base. complex))
111- @eval $ f (:: Type{Missing} ) = Missing
112- @eval function $f (:: Type{Union{T, Missing}} ) where T
113- T === Any && throw (MethodError ($ f, (Any,))) # To prevent StackOverflowError
114- Union{$ f (T), Missing}
115- end
107+ for f in (:float , :complex )
108+ @eval ($ f)(:: Type{Any} ) = throw (MethodError ($ f, (Any,))) # To prevent StackOverflowError
109+ @eval ($ f)(:: Type{T} ) where {T>: Missing } = Union{$ f (nonmissingtype_checked (T)), Missing}
116110end
117111
118112# Binary operators/functions
0 commit comments