Skip to content

Commit

Permalink
fix reduced_indices type bug (#44096)
Browse files Browse the repository at this point in the history
The result is type-asserted to be equal to the input, so we need to use
a non-promoting function.
  • Loading branch information
vtjnash committed Mar 1, 2022
1 parent 3a5dc09 commit c6e3146
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/reducedim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function reduced_indices0(inds::Indices{N}, d::Int) where N
end

function reduced_indices(inds::Indices{N}, region) where N
rinds = [inds...]
rinds = collect(inds)
for i in region
isa(i, Integer) || throw(ArgumentError("reduced dimension(s) must be integers"))
d = Int(i)
Expand All @@ -58,7 +58,7 @@ function reduced_indices(inds::Indices{N}, region) where N
end

function reduced_indices0(inds::Indices{N}, region) where N
rinds = [inds...]
rinds = collect(inds)
for i in region
isa(i, Integer) || throw(ArgumentError("reduced dimension(s) must be integers"))
d = Int(i)
Expand Down

0 comments on commit c6e3146

Please sign in to comment.