Skip to content

SortedSet{K,Ord}(), SortedDict{K,V,Ord}() and SortedMultiDict{K,V,Ord}() throw for non-forward Ord #1002

Open

Description

@ParadaCarleton
using DataStructures
R = typeof(Base.Order.Reverse)
SortedSet{Int, R}()
SortedDict{Int, Int, R}()
SortedMultiDict{Int, Int, R}()

Each call throws on master (b9ff234), Julia 1.13.4:

ERROR: MethodError: Cannot `convert` an object of type Base.Order.ForwardOrdering to an object of type DataStructures.BalancedTree23{Int64, Nothing, Base.Order.ReverseOrdering{Base.Order.ForwardOrdering}}

The constructors take o::Ord=Forward with Ord a parameter of the constructed type (src/sorted_set.jl:18, src/sorted_dict.jl:19, src/sorted_multi_dict.jl:17). The default Forward is a ForwardOrdering, so the zero-argument method matches only when Ord is ForwardOrdering. For other orderings, the call falls through to the inner constructor that takes a BalancedTree23.

Passing the ordering works: SortedSet{Int, R}(Base.Order.Reverse). Forms where Ord is a method parameter (SortedSet(o::Ord=Forward) where {Ord}) are fine.

Activity

  1. oxinabox commented on Nov 18, 2026

    @oxinabox
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions