-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
I found the following inconsistence in method_exists:
# without type parameters, all good:
f(x,y) = 1
@assert method_exists(f, (None, None))
@assert method_exists(f, (Int, None))
@assert method_exists(f, (Int, Int))
@assert method_exists(f, (None, Int))
# with two type parameters, all good:
h{T,K}(x::T,y::K) = 1
@assert method_exists(h, (None, None))
@assert method_exists(h, (Int, None))
@assert method_exists(h, (Int, Int))
@assert method_exists(h, (None, Int))
# with one type parameter:
g{T}(x::T,y) = 1
@assert method_exists(g, (None, None))
# ERROR: assertion failed: method_exists(g,(None,None))
# in error at error.jl:21
@assert method_exists(g, (Int, None))
# ERROR: assertion failed: method_exists(g,(Int,None))
# in error at error.jl:21
@assert method_exists(g, (Int, Int))
@assert method_exists(g, (None, Int))I think the last example should work like the second one.
Metadata
Metadata
Assignees
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch