Open
Description
The following behaviour can be reproduced in Julia v1.8-v1.10.0-DEV.
julia> Int[] .+ String[]
Union{}[]
julia> Int[] .* String[]
Union{}[]
It can be also observed at map
operations:
julia> map(+, Int[], String[])
Union{}[]
This is caused by missing some necessary checks when using type inference tricks to pre-decide the element type. If the type level computation gets us a bottom type, raising an exception looks more appropriate:
R = Base.return_type(f, Tuple{A, B})
R == Base.Bottom && error("invalid operation ...")
# do stuff