Skip to content

Commit 3f0ae6e

Browse files
authored
Fix fpsort! for non Int indices (#43934)
* Extend allowsmissing and ismissing to Integer * Test #43925
1 parent 15df9c0 commit 3f0ae6e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

base/sort.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,10 +1146,10 @@ isnan(o::Perm, i::Integer) = isnan(o.order,o.data[i])
11461146

11471147
ismissing(o::DirectOrdering, x::Floats) = false
11481148
ismissing(o::DirectOrdering, x::Missing) = true
1149-
ismissing(o::Perm, i::Int) = ismissing(o.order,o.data[i])
1149+
ismissing(o::Perm, i::Integer) = ismissing(o.order,o.data[i])
11501150

11511151
allowsmissing(::AbstractVector{T}, ::DirectOrdering) where {T} = T >: Missing
1152-
allowsmissing(::AbstractVector{Int},
1152+
allowsmissing(::AbstractVector{<:Integer},
11531153
::Perm{<:DirectOrdering,<:AbstractVector{T}}) where {T} =
11541154
T >: Missing
11551155

test/sorting.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ end
4949
end
5050
@test_throws ArgumentError sortperm!(view([1,2,3,4], 1:4), [2,3,1])
5151
@test sortperm(OffsetVector([8.0,-2.0,0.5], -4)) == OffsetVector([-2, -1, -3], -4)
52+
@test sortperm!(Int32[1,2], [2.0, 1.0]) == Int32[2, 1]
5253
end
5354

5455
@testset "misc sorting" begin

0 commit comments

Comments
 (0)