-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Extend backdating checks to imports and globals #59735
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Keno
wants to merge
1
commit into
master
Choose a base branch
from
kf/morebackdating
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+259
−83
Conversation
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
Previously, backdated binding warnings were only emitted for constants. This commit extends the backdating mechanism to handle imports and globals. This change was requested by triage to improve compatibility of the new binding partition mechanism given issues like #58511. With this change the behavior is as follows: ```julia julia> function foo() include_string(Main, "a = 42") return a end julia> foo() WARNING: Detected access to binding `Main.a` in a world prior to its definition world. Julia 1.12 has introduced more strict world age semantics for global bindings. !!! This code may malfunction under Revise. !!! This code will error in future versions of Julia. Hint: Add an appropriate `invokelatest` around the access to this binding. To make this warning an error, and hence obtain a stack trace, use `julia --depwarn=error`. 42 ``` With `julia --depwarn=error`, the access is rejected: ```julia julia> foo() ERROR: UndefVarError: `a` not defined in `Main` ``` I am still not a huge fan of the backdating mechanism in general, but I think this is the least objectionable of the alternatives and provides a big warning to let people know that something is wrong.
I pretty much think this is too risky to put in this late in the release process, and that the current status quo is the lesser evil. For example, this PR fails CI on a random assortment of tests, and Revise stops working:
|
vtjnash
added a commit
that referenced
this pull request
Oct 6, 2025
Also remove `isdefined` shim, as that feels less logical to me with the current implementation that uses invokelatest. If the implementation was changed to use `invokenext`, I think it would make sense to add that back and also to update `names` to return these also. But invoke next (similar to backdated constants and #59735) prints an incorrect suggestion of using invokelatest to get the same behavior. That message is correct with this current commit state, but wrong relative to the current implementations that use backdated.
vtjnash
added a commit
that referenced
this pull request
Oct 6, 2025
Rebinding test failure is #59613, so we should merge that first. |
effects.jl is the combination of a pre-existing codegen model bug (will PR separately) with #59613 |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport 1.12
Change should be backported to release-1.12
needs pkgeval
Tests for all registered packages should be run with this change
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.
Previously, backdated binding warnings were only emitted for constants. This commit extends the backdating mechanism to handle imports and globals. This change was requested by triage to improve compatibility of the new binding partition mechanism given issues like #58511.
With this change the behavior is as follows:
With
julia --depwarn=error
, the access is rejected:I am still not a huge fan of the backdating mechanism in general, but I think this is the least objectionable of the alternatives and provides a big warning to let people know that something is wrong.
Largely written by Claude.