-
-
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 set of definitions should be sorted by number, but do not get sorted correctly:
f(::Vector) = 1
f(::AbstractVector) = 2
f(::Matrix) = 3
f(::AbstractMatrix) = 4
f(::Array) = 5 # this ends up between 1 and 2 instead!Assertion failed: (!jl_subtype((jl_value_t*)sig, (jl_value_t*)type)), function check_ambiguous_visitor, file /Volumes/Lion/Users/jameson/Documents/julia/src/gf.c, line 1129.
This breaks the DataArrays package (which tries to add this set of methods to the round function)
Specifically, the bug is that the following result is wrong:
julia> args_morespecific(Tuple{Array}, Tuple{AbstractVector})
trueOr that the following result is wrong:
julia> args_morespecific(Tuple{Matrix}, Tuple{AbstractVector})
falsesince because Matrix <: Array, more-specific(Matrix) should be higher than more-specific(Array)
more generally, I believe this means that the formal definition of more-specific is exactly:
more-specific(A, B) implies more-specific(C, D) for-all C <: A and D >: B
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