Skip to content

Commit

Permalink
remove pessimistic "no method matches right now" from inference
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Aug 30, 2016
1 parent 0226294 commit eb57536
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const MAX_TUPLE_DEPTH = 4

const MAX_TUPLE_SPLAT = 16
const MAX_UNION_SPLITTING = 4
const UNION_SPLIT_MISMATCH_ERROR = false

# alloc_elim_pass! relies on `Slot_AssignedOnce | Slot_UsedUndef` being
# SSA. This should be true now but can break if we start to track conditional
Expand Down Expand Up @@ -818,13 +817,6 @@ function abstract_call_gf_by_type(f::ANY, atype::ANY, sv::InferenceState)
return Any
end
x::Array{Any,1} = applicable
if isempty(x)
# no methods match
# TODO: it would be nice to return Bottom 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
fullmatch = false
for (m::SimpleVector) in x
sig = m[1]
Expand Down Expand Up @@ -2535,7 +2527,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
all = false
end
end
if UNION_SPLIT_MISMATCH_ERROR && all
if all
error_label === nothing && (error_label = genlabel(sv))
push!(stmts, GotoNode(error_label.label))
else
Expand All @@ -2554,7 +2546,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
append!(stmts, match)
if error_label !== nothing
push!(stmts, error_label)
push!(stmts, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "error in type inference due to #265"))
push!(stmts, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (type bound)"))
end
local ret_var, merge
if spec_miss !== nothing
Expand Down Expand Up @@ -2781,7 +2773,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
lastexpr = pop!(body.args)
if isa(lastexpr,LabelNode)
push!(body.args, lastexpr)
push!(body.args, Expr(:call, GlobalRef(_topmod(sv.mod),:error), "fatal error in type inference"))
push!(body.args, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (lowering)"))
lastexpr = nothing
elseif !(isa(lastexpr,Expr) && lastexpr.head === :return)
# code sometimes ends with a meta node, e.g. inbounds pop
Expand Down

0 comments on commit eb57536

Please sign in to comment.