Skip to content

Commit c5b73d6

Browse files
authored
Make sure BlockedUnitRange returns an Integer (triggered when combined with InfiniteArrays) (#259)
1 parent 1be1788 commit c5b73d6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockArrays"
22
uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
3-
version = "0.16.27"
3+
version = "0.16.28"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/blockaxis.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ blocksizes(A,i) = blocklengths(axes(A,i))
197197
axes(b::BlockedUnitRange) = (_BlockedUnitRange(blocklasts(b) .- (first(b)-1)),)
198198
unsafe_indices(b::BlockedUnitRange) = axes(b)
199199
first(b::BlockedUnitRange) = b.first
200-
last(b::BlockedUnitRange) = isempty(blocklasts(b)) ? first(b)-1 : last(blocklasts(b))
200+
# ::Integer works around case where blocklasts might return different type
201+
last(b::BlockedUnitRange)::Integer = isempty(blocklasts(b)) ? first(b)-1 : last(blocklasts(b))
201202

202203
function getindex(b::BlockedUnitRange, K::Block{1})
203204
k = Integer(K)

0 commit comments

Comments
 (0)