You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inlining: make union splitting account for uncovered call
#44421 changed the union-splitting to skip generating
unnecessary fallback dynamic dispatch call when there is any fully
covered call.
But it turned out that this is only valid when there is any fully
covered call in matches for all signatures that inference split, and it
is invalid if there is any union split signature against which any
uncovered call is found.
Consider the following example:
# case 1
# def
nosplit(::Any) = [...]
nosplit(::Int) = [...]
# call
nosplit(a::Any)
split1: a::Any ┬ nosplit(a::Int)
└ nosplit(a::Any) # fully covers split1
# case 2
# def
convert(::Type{T}, ::T) = T
# call
convert(::Type{Union{Bool,Tuple{Int,String}}}, a::Union{Bool,Tuple{Int,Any}})
split1: a::Bool ─ convert(::Type{Bool}, ::Bool) # fully covers split1
split2: a::Tuple{Int,Any} ─ convert(::Type{Tuple{Int,String}}, ::Tuple{Int,String}) # NOT fully covers split2
#44421 allows us to optimize the the first case, but
handles the second case wrongly. This commit fixes it up while still
optimizing the first case.
fix#48397.
0 commit comments