Skip to content

Commit 2ee5949

Browse files
Merge pull request #15 from oxinabox/patch-1
Remove type-piracy
2 parents 787a2ed + 909b514 commit 2ee5949

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/EllipsisNotation.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ __precompile__()
33
module EllipsisNotation
44

55
import Base: to_indices, tail
6-
const .. = Val{:..}()
6+
7+
struct Ellipsis end
8+
const .. = Ellipsis()
79

810
@inline fillcolons(inds, I) = fillcolons((), inds, I)
911

@@ -12,15 +14,15 @@ const .. = Val{:..}()
1214
@inline fillcolons(colons, t::NTuple{N, <:Any}, ::NTuple{N, <:Any}) where {N} = colons
1315
@inline fillcolons(colons, t::Tuple, s::Tuple) = fillcolons((colons..., :), tail(t), s)
1416

15-
@inline function to_indices(A, inds, I::Tuple{Val{:..}, Vararg{Any, N}}) where N
17+
@inline function to_indices(A, inds, I::Tuple{Ellipsis, Vararg{Any, N}}) where N
1618
# Align the remaining indices to the tail of the `inds`
1719
colons = fillcolons(inds, tail(I))
1820
to_indices(A, inds, (colons..., tail(I)...))
1921
end
2022

2123
# avoid copying if indexing with .. alone, see
2224
# https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/issues/214
23-
@inline Base.getindex(A::AbstractArray, ::Val{:..}) = A
25+
@inline Base.getindex(A::AbstractArray, ::Ellipsis) = A
2426

2527
export ..
2628

0 commit comments

Comments
 (0)