Skip to content

Commit

Permalink
fall back to dynamic dispatch in union-splitting optimization
Browse files Browse the repository at this point in the history
This should help #17932. If a function returns an unanticipated type
that wasn't part of the `Union` seen by inference, do dynamic
dispatch instead of erroring.

(cherry picked from commit b0cf591)
ref #18046
  • Loading branch information
JeffBezanson authored and tkelman committed Aug 22, 2016
1 parent 39a75bf commit f8fada1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const MAX_TUPLETYPE_LEN = 15
const MAX_TUPLE_DEPTH = 4

const MAX_TUPLE_SPLAT = 16
const MAX_UNION_SPLITTING = 6
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 @@ -2437,7 +2438,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
all = false
end
end
if all
if UNION_SPLIT_MISMATCH_ERROR && all
error_label === nothing && (error_label = genlabel(sv))
push!(stmts, GotoNode(error_label.label))
else
Expand Down

0 comments on commit f8fada1

Please sign in to comment.