Skip to content

Commit eb724e0

Browse files
authored
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`).
1 parent c5158f4 commit eb724e0

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
@@ -656,6 +656,8 @@ end
656656

657657
defalg(v::AbstractArray) = DEFAULT_STABLE
658658
defalg(v::AbstractArray{<:Union{Number, Missing}}) = DEFAULT_UNSTABLE
659+
defalg(v::AbstractArray{Missing}) = DEFAULT_UNSTABLE
660+
defalg(v::AbstractArray{Union{}}) = DEFAULT_UNSTABLE
659661

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

0 commit comments

Comments
 (0)