Fix nospecializing Functions in `Union{Nothing,Function}` params (#59327)
Fixes https://github.com/JuliaLang/julia/issues/59326.
Change the logic that decides not to specialize a function parameter
based on whether or not the supplied argument is a Function, and that
function is not used, so that it will still work if the SpecType is a
Union{Function,Nothing} or any other union that contains a Function.
The logic is changed from a hardcoded rule of `type_i == Function ||
type_i == Any || type_i == Base.Callable` to `type_i >: Function`.
This covers all of the above cases, but also includes custom
`Union{Function, T}` such as `Union{Function, Nothing}`.
---------
Co-authored-by: Nick Robinson <npr251@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>