Skip to content

Commit a9cca92

Browse files
authored
Don't specialize equality for OneToInf (#166)
1 parent a377e7b commit a9cca92

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/infrange.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ AbstractArray{T}(a::OneToInf) where T<:Real = InfUnitRange{T}(a)
143143
AbstractVector{T}(a::OneToInf) where T<:Real = InfUnitRange{T}(a)
144144

145145

146-
(==)(::OneToInf, ::OneToInf) = true
147-
148146
## interface implementations
149147

150148
size(r::InfRanges) = (ℵ₀,)

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ end
298298
@test 0.0:0.1:!= 0.0f0:0.1f0:
299299
end
300300

301+
@testset "constprop in comparing OneToInf" begin
302+
r1 = OneToInf{Int8}()
303+
r2 = OneToInf{Int16}()
304+
v = @inferred ((r1,r2) -> Val(r1 == r2))(r1, r2)
305+
@test v isa Val{true}
306+
end
307+
301308
@testset "comparing InfiniteUnitRanges and OneToInf" begin
302309
@test 1:2:== 1:2:!= 1:3:!= 2:3:== 2:3:!= 2:
303310
@test 1:1:== 1:== 1:== OneToInf() == OneToInf()

0 commit comments

Comments
 (0)