Skip to content

Commit

Permalink
Merge pull request #351 from JeffBezanson/jb/subtype
Browse files Browse the repository at this point in the history
use `eltype` instead of `T.parameters[1]`
  • Loading branch information
JeffBezanson authored Dec 29, 2016
2 parents 9966858 + f830d7d commit e67e7f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1654,14 +1654,15 @@ end
if !(T<:Array)
error("Dataset indexing (hyperslab) is available only for arrays")
end
if !(T.parameters[1]<:HDF5BitsKind)
ET = eltype(T)
if !(ET<:HDF5BitsKind)
error("Dataset indexing (hyperslab) is available only for bits types")
end
if length(X) != prod(map(length, indices))
error("number of elements in range and length of array must be equal")
end
if eltype(X) != T.parameters[1]
X = convert(Array{T.parameters[1]}, X)
if eltype(X) != ET
X = convert(Array{ET}, X)
end
dsel_id = hyperslab(dset, indices...)
memtype = datatype(X)
Expand Down

0 comments on commit e67e7f9

Please sign in to comment.