methods
returns wrong result for triangular dispatch #18348
Closed
Description
See below, methods
returns two methods even though only the second one (the first in the returned array) can possibly be called. This is the reason we are doing a dynamic dispatch at all in #18331 . (and without this fixed allocation elimination can't fully work either)
julia> f{T<:Any}(::Type{T}, x) = 1
f (generic function with 1 method)
julia> f{T<:Any}(::Type{T}, x::T) = 2
f (generic function with 2 methods)
julia> methods(f, Tuple{Type{Any},Any})
#2 methods for generic function "f":
f{T}(::Type{T}, x::T) at REPL[2]:1
f{T}(::Type{T}, x) at REPL[1]:1
Activity