Skip to content

Commit

Permalink
Use triangular dispatch in eltype definition (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters authored and ararslan committed Feb 22, 2018
1 parent 862afdc commit e8838e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Base: show, summary, size, ndims, length, eltype,
# DFT plan where the inputs are an array of eltype T
abstract type Plan{T} end

eltype(::Type{Plan{T}}) where {T} = T
eltype(::Type{<:Plan{T}}) where {T} = T

# size(p) should return the size of the input array for p
size(p::Plan, d) = size(p)[d]
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Base.:*(p::InverseTestPlan, x::Vector) = mul!(copy(x), p, x)

fftw_ifft = [Complex{Float64}(i, 0) for i in 1:8]
@test AbstractFFTs.ifft(x) fftw_ifft

@test eltype(plan_fft(collect(1:8))) == Int
end

@testset "Shift functions" begin
Expand Down

0 comments on commit e8838e4

Please sign in to comment.