Skip to content

include? returns nil instead of false if not included #2

@jaynetics

Description

@jaynetics

i found a potentially breaking change compared to the stdlib version of SortedSet:

on Ruby 2.7:

require 'set'
SortedSet.new.include?(1) # => false

on Ruby 3.0:

require 'sorted_set'
SortedSet.new.include?(1) # => nil

RBTree and Set return false in this case, but this code in set leads to nil being returned if anything other than a Hash defaulting to false is used as @hash. I guess this could either be fixed here in sorted_set by overriding #include? and its aliases, or in set by adding !! or so to the return value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions