Skip to content

Commit

Permalink
fix #5401
Browse files Browse the repository at this point in the history
type inference was being too greedy by returning `None` for no matching
methods. it's safer to be able to handle methods that might not be
defined yet. we might be able to roll back this change when #265 is
fixed.

also fix a bug in ... with keyword arguments that caused GiovineItalia/Gadfly.jl#157
  • Loading branch information
JeffBezanson committed Jan 16, 2014
1 parent 6d1d726 commit 6002358
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,10 @@ function abstract_call_gf(f, fargs, argtypes, e)
x::Array{Any,1} = applicable
if isempty(x)
# no methods match
return None
# TODO: it would be nice to return None here, but during bootstrap we
# often compile code that calls methods not defined yet, so it is much
# safer just to fall back on dynamic dispatch.
return Any
end
if isa(e,Expr)
if length(x)==1
Expand Down Expand Up @@ -708,8 +711,11 @@ function abstract_call(f, fargs, argtypes, vtypes, sv::StaticVarInfo, e)
end
return Tuple
end
if is(af,kwcall)
return Any
end
# apply known function with unknown args => f(Any...)
return abstract_call(_ieval(af), (), Tuple, vtypes, sv, ())
return abstract_call(af, (), Tuple, vtypes, sv, ())
end
end
if isgeneric(f)
Expand Down

0 comments on commit 6002358

Please sign in to comment.