diff --git a/base/reflection.jl b/base/reflection.jl index 6cb18c4e027ade..b24a2c7acbca11 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -188,11 +188,15 @@ function _methods(f::ANY,t::ANY,lim) end function _methods_by_ftype(t::ANY, lim) tp = t.parameters + nu = 1 for ti in tp if isa(ti, Union) - return _methods(Any[tp...], length(tp), lim, []) + nu *= length(ti.types) end end + if 1 < nu <= 64 + return _methods(Any[tp...], length(tp), lim, []) + end return ccall(:jl_matching_methods, Any, (Any,Int32), t, lim) end function _methods(t::Array,i,lim::Integer,matching::Array{Any,1})