Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/TracedRange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ function Base._reshape(parent::TracedUnitRange, dims::Dims)
return Base.__reshape((parent, IndexStyle(parent)), dims)
end

function (C::Base.Colon)(start::TracedRNumber{T},stop::TracedRNumber{T}) where T
TracedUnitRange(start,stop)
function (C::Base.Colon)(start::TracedRNumber{T}, stop::TracedRNumber{T}) where {T}
return TracedUnitRange(start, stop)
end
function (C::Base.Colon)(start::TracedRNumber{T},stop::T) where T
C(start,TracedRNumber{T}(stop))
function (C::Base.Colon)(start::TracedRNumber{T}, stop::T) where {T}
return C(start, TracedRNumber{T}(stop))
end
function (C::Base.Colon)(start::T,stop::TracedRNumber{T}) where T
C(TracedRNumber{T}(start),stop)
function (C::Base.Colon)(start::T, stop::TracedRNumber{T}) where {T}
return C(TracedRNumber{T}(start), stop)
end
end
8 changes: 4 additions & 4 deletions test/ranges.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Reactant,Test
using Reactant, Test

@testset "ranges" begin
i = Reactant.to_rarray(5,track_numbers=true)
i = Reactant.to_rarray(5; track_numbers=true)
@test Array{Int64}(@jit(1:i)) == collect(1:5)
@test Array{Int64}(@jit(i:10)) == collect(5:10)
j = Reactant.to_rarray(10,track_numbers=true)
@test Array{Int64}(@jit(i:j)) == collect(5:10)
j = Reactant.to_rarray(10; track_numbers=true)
@test Array{Int64}(@jit(i:j)) == collect(5:10)
end