-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviortypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
The following exhibits lack of transitivity in method specificity:
T1 = Tuple{typeof(convert),Type{Tuple{Vararg{AbstractUnitRange{Int64},N} where N}},CartesianIndices{N,R} where R<:Tuple{Vararg{AbstractUnitRange{Int64},N}}} where N
T2 = Tuple{typeof(convert),Type{T},T} where T<:AbstractArray
T3 = Tuple{typeof(convert),Type{AbstractArray{T,N} where N},AbstractArray} where T
T4 = Tuple{typeof(convert),Type{AbstractArray{T,N}},AbstractArray{s57,N} where s57} where N where T
msp(T,S) = ccall(:jl_type_morespecific, Cint, (Any, Any), T, S) != 0
msp(T1, T2)
msp(T2, T3) && msp(T2, T4)
@assert msp(T1, T3)
@assert msp(T1, T4)
Find your own with:
using LightGraphs
Ts = map(x->x.sig, methods(convert))
g = SimpleDiGraph(length(Ts));
for ((i, T), (j, S)) in Iterators.product(enumerate(Ts), enumerate(Ts))
if ccall(:jl_type_morespecific, Cint, (Any, Any), T, S) != 0
add_edge!(g, i, j)
end
end
for j in vertices(g)
if !all(d->d in (0, 1, typemax(Int)), gdistances(g, j))
error("Transitivity error at $(j)")
end
end
JeffBezansonJeffBezanson
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviortypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch