Skip to content

Commit eb57536

Browse files
committed
remove pessimistic "no method matches right now" from inference
1 parent 0226294 commit eb57536

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

base/inference.jl

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const MAX_TUPLE_DEPTH = 4
1010

1111
const MAX_TUPLE_SPLAT = 16
1212
const MAX_UNION_SPLITTING = 4
13-
const UNION_SPLIT_MISMATCH_ERROR = false
1413

1514
# alloc_elim_pass! relies on `Slot_AssignedOnce | Slot_UsedUndef` being
1615
# SSA. This should be true now but can break if we start to track conditional
@@ -818,13 +817,6 @@ function abstract_call_gf_by_type(f::ANY, atype::ANY, sv::InferenceState)
818817
return Any
819818
end
820819
x::Array{Any,1} = applicable
821-
if isempty(x)
822-
# no methods match
823-
# TODO: it would be nice to return Bottom here, but during bootstrap we
824-
# often compile code that calls methods not defined yet, so it is much
825-
# safer just to fall back on dynamic dispatch.
826-
return Any
827-
end
828820
fullmatch = false
829821
for (m::SimpleVector) in x
830822
sig = m[1]
@@ -2535,7 +2527,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
25352527
all = false
25362528
end
25372529
end
2538-
if UNION_SPLIT_MISMATCH_ERROR && all
2530+
if all
25392531
error_label === nothing && (error_label = genlabel(sv))
25402532
push!(stmts, GotoNode(error_label.label))
25412533
else
@@ -2554,7 +2546,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
25542546
append!(stmts, match)
25552547
if error_label !== nothing
25562548
push!(stmts, error_label)
2557-
push!(stmts, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "error in type inference due to #265"))
2549+
push!(stmts, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (type bound)"))
25582550
end
25592551
local ret_var, merge
25602552
if spec_miss !== nothing
@@ -2781,7 +2773,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
27812773
lastexpr = pop!(body.args)
27822774
if isa(lastexpr,LabelNode)
27832775
push!(body.args, lastexpr)
2784-
push!(body.args, Expr(:call, GlobalRef(_topmod(sv.mod),:error), "fatal error in type inference"))
2776+
push!(body.args, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (lowering)"))
27852777
lastexpr = nothing
27862778
elseif !(isa(lastexpr,Expr) && lastexpr.head === :return)
27872779
# code sometimes ends with a meta node, e.g. inbounds pop

0 commit comments

Comments
 (0)