That’s a bit of an odd requirement, though. After all, I can always implement my own type which is <: Number
and have sin(::MyType) = "foo"
. I don’t think we can make any statements at all about the return type of a function over an abstract type.
julia> struct Foo <: Number
end
julia> Base.sin(::Foo) = "hello"
julia> Base.promote_op(sin, Number)
Number
julia> sin(Foo())
"hello"