This is the definition of typeintersect
:
typeintersect(@nospecialize(a), @nospecialize(b)) = (@_total_meta; ccall(:jl_type_intersection, Any, (Any, Any), a::Type, b::Type))
It seems like the following would be an improvement, because an exception would be thrown sooner when any of the two arguments isn’t a Type
:
typeintersect(@nospecialize(a::Type), @nospecialize(b::Type)) = (@_total_meta; ccall(:jl_type_intersection, Any, (Any, Any), a, b))
Is this just because of backwards compatibility and the distinction between TypeError
and MethodError
? Or maybe it’s some kind of bootstrapping-related limitation?