Skip to content

Commit c312eac

Browse files
committed
fix stackoverflow in reshape
1 parent 1002455 commit c312eac

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _indexoffset(r::AbstractRange) = first(r) - 1
44
_indexoffset(i::Integer) = 0
55
_indexoffset(i::Colon) = 0
66
_indexlength(r::AbstractRange) = length(r)
7-
_indexlength(i::Integer) = i
7+
_indexlength(i::Integer) = Int(i)
88
_indexlength(i::Colon) = Colon()
99

1010
_strip_IdOffsetRange(r::IdOffsetRange) = parent(r)

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,13 @@ end
17671767
Arsc = reshape(A, :, 1)
17681768
Arsc[1,1] = 5
17691769
@test first(A) == 5
1770+
1771+
@testset "issue #235" begin
1772+
Vec64 = zeros(6)
1773+
ind_a_64 = 3
1774+
ind_a_32 =Int32.(ind_a_64)
1775+
@test reshape(Vec64, ind_a_32, :) == reshape(Vec64, ind_a_64, :)
1776+
end
17701777
end
17711778

17721779
@testset "permutedims" begin

0 commit comments

Comments
 (0)