Skip to content

Commit d572dc3

Browse files
committed
Loosen the requirements on == for Axis{name}(val)
1 parent 4a0e53a commit d572dc3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ immutable Axis{name,T}
5151
end
5252
# Constructed exclusively through Axis{:symbol}(...) or Axis{1}(...)
5353
@compat (::Type{Axis{name}}){name,T}(I::T=()) = Axis{name,T}(I)
54-
@compat Base.:(==){name,T}(A::Axis{name,T}, B::Axis{name,T}) = A.val == B.val
54+
@compat Base.:(==){name}(A::Axis{name}, B::Axis{name}) = A.val == B.val
5555
Base.hash{name}(A::Axis{name}, hx::UInt) = hash(A.val, hash(name, hx))
5656
axistype{name,T}(::Axis{name,T}) = T
5757
axistype{name,T}(::Type{Axis{name,T}}) = T

test/core.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ A = AxisArray(reshape(1:24, 2,3,4),
110110

111111
@test Axis{:col}(1) == Axis{:col}(1)
112112
@test Axis{:col}(1) != Axis{:com}(1)
113+
@test Axis{:x}(1:3) == Axis{:x}(Base.OneTo(3))
113114
@test hash(Axis{:col}(1)) == hash(Axis{:col}(1.0))
114115
@test hash(Axis{:row}()) != hash(Axis{:col}())
116+
@test hash(Axis{:x}(1:3)) == hash(Axis{:x}(Base.OneTo(3)))
115117
@test AxisArrays.axistype(Axis{1}(1:2)) == typeof(1:2)
116118
@test axisnames(Axis{1}, Axis{2}, Axis{3}) == (1,2,3)
117119

0 commit comments

Comments
 (0)