Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/rubyPublic
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Update child module name when parent gets a temp name set#12658

Open
eileencodes wants to merge1 commit intoruby:master
base:master
Choose a base branch
Loading
fromeileencodes:fix-21094

Conversation

eileencodes
Copy link
Member

@eileencodeseileencodes commentedJan 28, 2025
edited
Loading

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

Before:

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

After:

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

[Bug #21094]

When calling `set_temporary_name` on a parent module the child modulesshould get their name updated too.Before:```rubym = Module.newm::N = Module.newp m::N.name # => "#<Module:0x000000010d0a00b0>::N"m.set_temporary_name("foo")p m::N.name # => "#<Module:0x000000010d0a00b0>::N"```After:```rubym = Module.newm::N = Module.newp m::N.name # => "#<Module:0x000000010d0a00b0>::N"m.set_temporary_name("foo")p m::N.name # => "foo::N"```[Bug #21094]
@nobu
Copy link
Member

Shouldn’t this change too?

m=Module.newm::N=Module.newm::N::O=Module.newm.set_temporary_name("foo")pm::N::O

@eileencodes
Copy link
MemberAuthor

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

VALUE value = ce->value;
VALUE parental_path = *((VALUE *) payload);

rb_mod_set_temporary_name(value, build_const_path(parental_path, id));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If the anonymous module has a constant that is not anonymous class or module, this will raise an exception.
And will crash on a non-class/module constant.

@nobu
Copy link
Member

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nobunobunobu left review comments

@tenderlovetenderlovetenderlove approved these changes

Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@eileencodes@nobu@tenderlove

[8]ページ先頭

©2009-2025 Movatter.jp