Skip to content

Commit

Permalink
limit exponent on number of calls made by _methods for unions
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 1, 2016
1 parent e83862f commit 9fac2e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 9fac2e3

Please sign in to comment.