Repository navigation
fix(module): clear temporary name when module assigned to constant in named parent - #9797
Open
reginaldalfret wants to merge 1 commit into
Open
reginaldalfret wants to merge 1 commit into
reginaldalfret wants to merge 1 commit into
Conversation
… named parent When a class or module with a temporary name (via set_temporary_name) is subsequently assigned to a constant within a permanently-named outer module, the TEMP_NAME flag was not being cleared, causing subsequent #name and #to_s calls to continue treating the class as temporary and ignoring outer nesting. Additionally, calling set_temporary_name(nil) did not clear TEMP_NAME. Only assign a permanent base name and clear TEMP_NAME when the enclosing outer module has a permanent name, preserving temporary names when nested inside anonymous modules per RubySpec. Fixes jruby#9680 Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
Member
|
Hey Reginald, looks good. Out of curiosity, are you using a LLM, if so which? |
headius
requested changes
Oct 15, 2026
headius
left a comment
Member
There was a problem hiding this comment.
This looks good but the test should go under spec/ruby as part of RubySpec (it is testing standard Ruby behavior).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #9680.
When a class or module with a temporary name (via \set_temporary_name) was subsequently assigned to a constant within a permanently-named outer module, the internal \TEMP_NAME\ flag was not being cleared. As a result, subsequent #name\ and #to_s\ calls continued treating the class as a temporary module and ignored outer nesting, producing e.g. \Subclass\ instead of \Namespace::Subclass.
Additionally, calling \set_temporary_name(nil)\ did not clear \TEMP_NAME, leaving the flag set even after resetting to anonymous.
Changes
il.
Signed-off-by: reginaldalfret reginaldalfret@gmail.com