What is happening in this method definition "(generic function with 0 methods)"?

julia> struct S{T} end

julia> T(::S{T}) where {T <: Any} = one(T)
T (generic function with 0 methods)

It seems Julia is confused by the function name being the same as a type parameter. I guess Julia should throw an error here instead of defining a function without the method?

EDIT: Issue on Github:


Yes, it’s weird that a function was defined but no method was added nor was there an error. It’s beyond my depth to understand what happened here.

In case you haven’t found it yet, you were probably looking for this

julia> (::Type{T})(::S{T}) where T = one(T)

julia> Float64(S{Float64}())