Skip to content

Commit

Permalink
Merge pull request #13 from andreasnoack/anj/bug
Browse files Browse the repository at this point in the history
Temporarily add method to work around subtyping bug in Julia 0.6.2
  • Loading branch information
nalimilan authored Mar 15, 2018
2 parents b915ef0 + e431415 commit 3f9fc13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ julia:
- nightly
notifications:
email: false
matrix:
allow_failures:
- julia: nightly
# uncomment the following lines to override the default test script
#script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
Expand Down
12 changes: 12 additions & 0 deletions src/IndirectArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ Base.IndexStyle(::Type{IndirectArray{T,N,A,V}}) where {T,N,A,V} = IndexStyle(A)

Base.copy(A::IndirectArray) = IndirectArray(copy(A.index), copy(A.values))

if VERSION < v"0.6.3"
# This method is only necessary because of a bug in Julia 0.6.2 and can be removed
# when we no longer support that version
@inline function Base.getindex(A::IndirectArray{<:Any,1}, i::Int)
@boundscheck checkbounds(A.index, i)
@inbounds idx = A.index[i]
@boundscheck checkbounds(A.values, idx)
@inbounds ret = A.values[idx]
ret
end
end

@inline function Base.getindex(A::IndirectArray, i::Int)
@boundscheck checkbounds(A.index, i)
@inbounds idx = A.index[i]
Expand Down

0 comments on commit 3f9fc13

Please sign in to comment.