Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,8 @@ nucomp_real_p(VALUE self)
* Complex.rect(1) <=> Complex.rect(1, 1) # => nil # object.imag not zero.
* Complex.rect(1) <=> 'Foo' # => nil # object.imag not defined.
*
* \Class \Complex includes module Comparable,
* each of whose methods uses Complex#<=> for comparison.
* \Class \Complex includes module Comparable,
* each of whose methods uses Complex#<=> for comparison.
*/
static VALUE
nucomp_cmp(VALUE self, VALUE other)
Expand Down
293 changes: 165 additions & 128 deletions doc/language/ractor.md

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2012,13 +2012,15 @@ rb_mod_gt(VALUE mod, VALUE arg)

/*
* call-seq:
* self <=> object -> -1, 0, +1, or nil
* self <=> other -> -1, 0, 1, or nil
*
* Compares +self+ and +other+.
*
* Returns:
*
* - +-1+, if +self+ includes +object+, if or +self+ is a subclass of +object+.
* - +0+, if +self+ and +object+ are the same.
* - +1+, if +object+ includes +self+, or if +object+ is a subclass of +self+.
* - +-1+, if +self+ includes +other+, if or +self+ is a subclass of +other+.
* - +0+, if +self+ and +other+ are the same.
* - +1+, if +other+ includes +self+, or if +other+ is a subclass of +self+.
* - +nil+, if none of the above is true.
*
* Examples:
Expand All @@ -2029,8 +2031,10 @@ rb_mod_gt(VALUE mod, VALUE arg)
* Enumerable <=> Array # => 1
* # Class File is a subclass of class IO.
* File <=> IO # => -1
* IO <=> File # => 1
* File <=> File # => 0
* IO <=> File # => 1
* # Class File has no relationship to class String.
* File <=> String # => nil
*
*/

Expand Down
3 changes: 3 additions & 0 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -4315,6 +4315,9 @@ rb_str_eql(VALUE str1, VALUE str2)
* 'ab' <=> 'a' # => 1
* 'a' <=> :a # => nil
*
* \Class \String includes module Comparable,
* each of whose methods uses String#<=> for comparison.
*
* Related: see {Comparing}[rdoc-ref:String@Comparing].
*/

Expand Down
1 change: 1 addition & 0 deletions test/.excludes-mmtk/TestObjSpace.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
exclude(:test_dump_all_full, "testing behaviour specific to default GC")
exclude(:test_dump_flag_age, "testing behaviour specific to default GC")
exclude(:test_dump_flags, "testing behaviour specific to default GC")
exclude(:test_dump_objects_dumps_page_slot_sizes, "testing behaviour specific to default GC")
63 changes: 33 additions & 30 deletions test/ruby/test_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,38 +356,41 @@ def test_remove_instance_variable
end

def test_remove_instance_variable_re_embed
require "objspace"
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
c = Class.new do
attr_reader :a, :b, :c

c = Class.new do
def a = @a

def b = @b

def c = @c
end
def initialize
@a = nil
@b = nil
@c = nil
end
end

o1 = c.new
o2 = c.new

o1.instance_variable_set(:@foo, 5)
o1.instance_variable_set(:@a, 0)
o1.instance_variable_set(:@b, 1)
o1.instance_variable_set(:@c, 2)
refute_includes ObjectSpace.dump(o1), '"embedded":true'
o1.remove_instance_variable(:@foo)
assert_includes ObjectSpace.dump(o1), '"embedded":true'

o2.instance_variable_set(:@a, 0)
o2.instance_variable_set(:@b, 1)
o2.instance_variable_set(:@c, 2)
assert_includes ObjectSpace.dump(o2), '"embedded":true'

assert_equal(0, o1.a)
assert_equal(1, o1.b)
assert_equal(2, o1.c)
assert_equal(0, o2.a)
assert_equal(1, o2.b)
assert_equal(2, o2.c)
o1 = c.new
o2 = c.new

o1.instance_variable_set(:@foo, 5)
o1.instance_variable_set(:@a, 0)
o1.instance_variable_set(:@b, 1)
o1.instance_variable_set(:@c, 2)
refute_includes ObjectSpace.dump(o1), '"embedded":true'
o1.remove_instance_variable(:@foo)
assert_includes ObjectSpace.dump(o1), '"embedded":true'

o2.instance_variable_set(:@a, 0)
o2.instance_variable_set(:@b, 1)
o2.instance_variable_set(:@c, 2)
assert_includes ObjectSpace.dump(o2), '"embedded":true'

assert_equal(0, o1.a)
assert_equal(1, o1.b)
assert_equal(2, o1.c)
assert_equal(0, o2.a)
assert_equal(1, o2.b)
assert_equal(2, o2.c)
end;
end

def test_convert_string
Expand Down