Skip to content

Commit

Permalink
Move the workaround to src
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner committed Nov 29, 2024
1 parent 6b61f96 commit 27b3ce4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1759,13 +1759,15 @@ julia> v
"""
sort(v::AbstractVector; kws...) = sort!(copymutable(v); kws...)

function sort(x::NTuple{<:Any,T};
function sort(x::NTuple;
alg::Algorithm=defalg(x),
lt=isless,
by=identity,
rev::Union{Bool,Nothing}=nothing,
order::Ordering=Forward,
scratch::Union{Vector{T}, Nothing}=nothing) where T
scratch::Union{Vector, Nothing}=nothing)
# Can't do this check with type parameters because of https://github.com/JuliaLang/julia/issues/56698
scratch === nothing || x isa NTuple{<:Any, eltype(scratch)} || throw(ArgumentError("scratch's eltype can't accommodate all the input elements"))
_sort(x, alg, ord(lt,by,rev,order), (;scratch))::typeof(x)
end
# Folks who want to hack internals can define a new _sort(x::NTuple, ::TheirAlg, o::Ordering)
Expand Down
1 change: 0 additions & 1 deletion test/ambiguous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ end
pop!(need_to_handle_undef_sparam, which(Base._totuple, (Type{Tuple{Vararg{E}}} where E, Any, Any)))
pop!(need_to_handle_undef_sparam, which(Base.eltype, Tuple{Type{Tuple{Any}}}))
pop!(need_to_handle_undef_sparam, first(methods(Base.same_names)))
pop!(need_to_handle_undef_sparam, which(sort, Tuple{Tuple{}})) # https://github.com/JuliaLang/julia/issues/56698
@test_broken isempty(need_to_handle_undef_sparam)
pop!(need_to_handle_undef_sparam, which(Base._cat, Tuple{Any, AbstractArray}))
pop!(need_to_handle_undef_sparam, which(Base.byteenv, (Union{AbstractArray{Pair{T,V}, 1}, Tuple{Vararg{Pair{T,V}}}} where {T<:AbstractString,V},)))
Expand Down

0 comments on commit 27b3ce4

Please sign in to comment.