Skip to content

Commit

Permalink
Undef is a perfectly fine type, ANY is less fine
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jun 9, 2014
1 parent 19d20ac commit 2bc684b
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2039,13 +2039,6 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
# end
# end

# Undef is a bad type
for ty in atypes
if Undef <: ty
return NF
end
end

if !isa(linfo,LambdaStaticData) || meth[3].func.env !== ()
return NF
end
Expand Down Expand Up @@ -2170,7 +2163,10 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
# when 1 method matches the inferred types, there is still a chance
# of a no-method error at run time, unless the inferred types are a
# subset of the method signature.
if !(atypes <: meth[1])
methargs = meth[1]
nm = length(methargs)
if !(atypes <: methargs)
incompletematch = true
t = Expr(:call) # tuple(argexprs...)
t.typ = Tuple
argexprs2 = t.args
Expand All @@ -2181,20 +2177,14 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
thrw.typ = None
push!(stmts, thrw)
push!(stmts, icall)
incompletematch = true
else
incompletematch = false
end
methargs = meth[1]
nm = length(methargs)

for i=na:-1:1 # stmts_free needs to be calculated in reverse-argument order
a = args[i]
aei = argexprs[i]
aeitype = argtype = exprtype(aei)
if aeitype == ANY
aeitype = Any
end
needtypeassert = false
if incompletematch
if isva
Expand Down Expand Up @@ -2223,6 +2213,9 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
end
end
end
if isa(methitype,TypeVar) # eliminate ANY
methitype = methitype.ub
end
if !(aeitype <: methitype)
needtypeassert = true
aeitype = methitype
Expand Down

0 comments on commit 2bc684b

Please sign in to comment.