Repository navigation
Implement the TOPLEVEL_BINDING constant - #429
Merged
Merged
Conversation
TOPLEVEL_BINDING was undefined, so any code referencing it raised
"uninitialized constant TOPLEVEL_BINDING" — this was the bulk of the
remaining errors in the core/main specs, which use
TOPLEVEL_BINDING.eval(...) to exercise top-level behaviour.
It is now defined as a Binding whose receiver is main and whose definee
is Object, starting with no locals of its own — so
TOPLEVEL_BINDING.eval("def m; end" / "K = 1" / "self") defines methods,
assigns constants and reports self exactly as top-level code does.
Verified against ruby 4.0.6; this lifts the core/main specs (public now
5/5, private/using improved) by turning the constant-missing errors into
runnable examples.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
TOPLEVEL_BINDINGwas undefined, so any code referencing it raiseduninitialized constant TOPLEVEL_BINDING— the bulk of the remainingerrors in the
core/mainspecs, which useTOPLEVEL_BINDING.eval(...)to exercise top-level behaviour.
It is now defined as a
Bindingwhose receiver ismainand whosedefinee is
Object, starting with no locals of its own — soTOPLEVEL_BINDING.eval("def m; end" / "K = 1" / "self")definesmethods, assigns constants and reports
selfexactly as top-level codedoes.
Verified against ruby 4.0.6; a full language+core sweep shows +8 with no
regressions (
core/main/publicnow 5/5,private/using/to_simproved as their constant-missing errors become runnable examples), and
the whole-suite coverage gate stays at 100.0%.
🤖 Generated with Claude Code