Repository navigation
Resolve bare symbols in calls to GlobalRefs on Julia 1.12+ - #164
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #164 +/- ##
==========================================
+ Coverage 77.70% 77.72% +0.02%
==========================================
Files 16 16
Lines 1619 1634 +15
==========================================
+ Hits 1258 1270 +12
- Misses 361 364 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CarloLucibello
force-pushed
the
cl/bare-symbols
branch
2 times, most recently
from
October 15, 2026 15:59
ca8c5c3 to
cb04454
Compare
Since Julia 1.12 a bare symbol in a `:call` of a hand-built `CodeInfo` is no longer resolved in the module the code is compiled in, so e.g. `:(println(...))` inserted into IR hit `Core.println` instead of `Main.println`. Before building the `IRCode`, `update!` now turns bare symbols in call expressions into `GlobalRef`s on 1.12+. The module matches 1.10: the one passed to `func`/`evalir`, or the module of the `@dynamo` entry method; a bare `update!` defaults to the IR's method module, else `Main`. Quoted symbols and non-call expressions are left alone. Fixes #90. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CarloLucibello
force-pushed
the
cl/bare-symbols
branch
from
October 15, 2026 16:04
cb04454 to
6fb0dee
Compare
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.
Fixes #90.
On Julia 1.12+, a bare symbol in an inserted call no longer resolves in the module of the method being compiled. An example is
pushfirst!(ir, :(println("hi"))), as in theinsert!/pushfirst!docstrings. The symbol ends up asCore.println, which throws aMethodError. On 1.10 it resolved in the module the CodeInfo is compiled in.update!now pins bare symbols in:callstatements toGlobalRefs, on 1.12+ only. The module matches what 1.10 does:@dynamo: the dynamo's own module, i.e. the module of the generated entry method. It is not the module of the function being rewritten.func(m, ir)/evalir(m, ...): alwaysm.update!(ci, ir): the IR's method module, orMainif there is none.The tests cover a dynamo in one module rewriting a function from another, for both a function dynamo and a callable-struct dynamo, and
evalirinto a given module with and withoutMeta. Bare symbols nested inside other expressions, or under non-:callheads, are not rewritten.🤖 Generated with Claude Code