ruby icon indicating copy to clipboard operation
ruby copied to clipboard

Update child module name when parent gets a temp name set

Open eileencodes opened this issue 11 months ago • 3 comments

When calling set_temporary_name on a parent module the child modules should get their name updated too.

Before:

m = Module.new
m::N = Module.new
p m::N.name # => "#<Module:0x000000010d0a00b0>::N"

m.set_temporary_name("foo")
p m::N.name # => "#<Module:0x000000010d0a00b0>::N"

After:

m = Module.new
m::N = Module.new
p m::N.name # => "#<Module:0x000000010d0a00b0>::N"

m.set_temporary_name("foo")
p m::N.name # => "foo::N"

[Bug #21094]

eileencodes avatar Jan 28 '25 18:01 eileencodes

Shouldn’t this change too?

m = Module.new
m::N = Module.new
m::N::O = Module.new

m.set_temporary_name("foo")
p m::N::O

nobu avatar Jan 29 '25 01:01 nobu

Ah yea that should work too. I'll fix it tomorrow morning.

eileencodes avatar Jan 29 '25 01:01 eileencodes