Skip to content

Commit dbce8f4

Browse files
committed
resolve method ambiguities
1 parent f7c324b commit dbce8f4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/algorithms.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ New types should prefer to register their default algorithms in the type domain.
117117
""" default_algorithm
118118
default_algorithm(f::F, A; kwargs...) where {F} = default_algorithm(f, typeof(A); kwargs...)
119119
# avoid infinite recursion:
120-
default_algorithm(f, T::Type; kwargs...) = throw(MethodError(default_algorithm, (f, T)))
120+
function default_algorithm(f::F, ::Type{T}; kwargs...) where {F,T}
121+
throw(MethodError(default_algorithm, (f, T)))
122+
end
121123

122124
@doc """
123125
copy_input(f, A)
@@ -198,10 +200,11 @@ macro functiondef(f)
198200
end
199201

200202
# define fallbacks for algorithm selection
201-
@inline function select_algorithm(::typeof($f), A, alg::Alg; kwargs...) where {Alg}
203+
@inline function select_algorithm(::typeof($f), ::Type{A}, alg::Alg;
204+
kwargs...) where {Alg,A}
202205
return select_algorithm($f!, A, alg; kwargs...)
203206
end
204-
@inline function default_algorithm(::typeof($f), A; kwargs...)
207+
@inline function default_algorithm(::typeof($f), ::Type{A}; kwargs...) where {A}
205208
return default_algorithm($f!, A; kwargs...)
206209
end
207210

0 commit comments

Comments
 (0)