Skip to content

Commit a0f8600

Browse files
bkaminsstaticfloat
authored andcommitted
Add defalg methods to resolve potential dispatch ambiguities (#43426)
We could also consider adding `defalg(v::AbstractArray{<:Number}) = DEFAULT_UNSTABLE`, but it is unlikely that someone will want to do `Union` of `<:Number` and something other than `Missing` that still would support comparison. Relevant for JuliaStrings/InlineStrings.jl#21 (and other custom types that will want to add `defalg` support allowing for `Union` with `Missing`). (cherry picked from commit eb724e0)
1 parent 480d850 commit a0f8600

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

base/sort.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ end
651651

652652
defalg(v::AbstractArray) = DEFAULT_STABLE
653653
defalg(v::AbstractArray{<:Union{Number, Missing}}) = DEFAULT_UNSTABLE
654+
defalg(v::AbstractArray{Missing}) = DEFAULT_UNSTABLE
655+
defalg(v::AbstractArray{Union{}}) = DEFAULT_UNSTABLE
654656

655657
function sort!(v::AbstractVector, alg::Algorithm, order::Ordering)
656658
inds = axes(v,1)

0 commit comments

Comments
 (0)