Suppose I have two classes and a function as follows:
abstract struct A end
struct B<:A end
and then the function
f(x::A) = true
f(x::B) = true
The function is supposed to return the same thing in both cases, the method f(x::B) being only a performance improvement w.r.t. f(x::A). To ensure that the functions are returning the same things, is there a way i could force, in my testing, the dispatch on x = B() to forget about the second method and use the first one ?
invoke(f, argtypes::Type, args...; kwargs...)
Invoke a method for the given generic function f matching the specified types argtypes on the specified
arguments args and passing the keyword arguments kwargs. The arguments args must conform with the
specified types in argtypes, i.e. conversion is not automatically performed. This method allows invoking a
method other than the most specific matching method, which is useful when the behavior of a more general
definition is explicitly needed (often as part of the implementation of a more specific method of the same
function).