fix: reach_script read a binding younger than the frame reading it - #22
Merged
Conversation
`reach_script` evaluates a script's top-level `const` lines into a scratch module and then
analyses a thunk that names them. The walk reads globals out of the IR, so it reaches a binding
created after its own caller was entered — and Julia 1.12 says what that is:
WARNING: Detected access to binding `ReachScript_figure.jl.RESULT` in a world prior to its
definition world.
!!! This code will error in future versions of Julia.
Two per full suite run, scrolling past a green suite. `Base.invokelatest` at the boundary is the
fix Julia's own hint names.
The test that pins it cost two attempts, and both failures are worth recording because each
produced a test that could not fail:
* It has to call `reach_script` from inside a **function**. A caller's world age is fixed when
it is entered; at top level it moves with every statement, and the first version of this test
passed against the unfixed package because of that.
* The child must run with the **default** `depwarn`. Measured on 1.12.2: `--depwarn=error`
*suppresses* this warning rather than promoting it — the opposite of what the warning's own
hint says — so the second version passed for the same reason as the first.
Verified in both directions: the test fails against the unfixed `reach.jl` with the warning text
in the child's stderr, and passes with it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
📚 Docs preview: https://codes.sota-shimozono.com/ExperimentalAPI.jl/previews/PR22/ (updates on each push to this PR) |
`test/spec/test_spec_lifecycle.jl` gained the world-age testset, so its behaviour count moved 15 → 16 and the total 178 → 179. The table in `test/spec/README.md` is generated and pinned by `test/test_spec_table.jl`, which is what caught this — the hand-written version drifted inside the change that introduced it, which is why it is pinned at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts: # test/spec/README.md
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
reach_scriptevaluates a script's top-levelconstlines into a scratch module and then analysesa thunk that names them. The walk reads globals out of the IR, so it reaches a binding created
after its own caller was entered:
Two per full suite run, scrolling past a green suite.
Base.invokelatestat the boundary is thefix Julia's own hint names.
The test cost two attempts, and both failures are the interesting part
Each produced a test that could not fail:
reach_scriptfrom inside a function. A caller's world age is fixed when itis entered; at top level it moves with every statement. The first version called it at top
level and passed against the unfixed package.
depwarn. Measured on 1.12.2,--depwarn=errorsuppresses this warning rather than promoting it — the opposite of what the warning's own
hint says — so the second version passed for the same reason as the first.
Verified in both directions: fails against the unfixed
reach.jlwith the warning text in thechild's stderr, passes with it.
🤖 Generated with Claude Code