Repository navigation
Use hygienic names for the generated call's where-parameters - #158
Merged
ChrisRackauckas merged 2 commits intoSep 26, 2026
Merged
Conversation
The `where`-parameters `argnames`, `cache_tag`, and `id` of the `generated_callfunc` method that `init` evals into the user's module are in scope inside the generated body, so a user global named `id` resolved to the function's internal id tuple instead of the module global. Rename them in the `ˍ₋rgf₋args` style so such globals resolve in the context module's scope, or throw UndefVarError when undefined. Fixes SciML#34. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.3 Agent-Model: swe-2-high Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-RuntimeGeneratedFunctions.jl-34/log.txt on amdci2.julia.csail.mit.edu
Arguments named `id`, `argnames`, or `cache_tag` hit the same collision as globals did: on the parent, `:((id,) -> id + 1)` fails to compile with `syntax: local variable name "id" conflicts with a static parameter`. Cover those cases in the hygiene testset and condense the explanatory comment to one line. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.3 Agent-Model: swe-2-high Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-RuntimeGeneratedFunctions.jl-34/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
September 26, 2026 09:32
Merged
ChrisRackauckas
referenced
this pull request
Sep 26, 2026
Agent-Harness: Claude Code Agent-Model: claude-opus-5-5[1m] Agent-Session: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL) Co-authored-by: Claude Opus 5.5 (1M context) <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.
Summary
init(mod)evals a@generatedgenerated_callfuncmethod into the user's module whosewhere-parameters were namedargnames,cache_tag, andid. Those bindings are in scope inside the generated body, so a user body referencing a global namedidsilently received the function's internalNTuple{5,UInt32}id instead of the module global (or anUndefVarError). The parameters are renamed toˍ₋rgf₋argnames,ˍ₋rgf₋cache_tag, andˍ₋rgf₋id, in the same hygienic style as the existingˍ₋rgf₋argssplat;init'smod.evalis the only place agenerated_callfuncmethod is defined. A regression test checks thatid/argnames/cache_tagresolve to context-module globals when defined and throwUndefVarErrorwhen not. The same collision also broke arguments with those names — on the parent,:((id,) -> id + 1)fails to compile withsyntax: local variable name "id" conflicts with a static parameter— so the testset covers the argument-name cases too.Fixes #34.
Test evidence
The new testset was run verbatim against the parent src (
ddf352d) and with the fix applied:Unfixed:
Fixed:
The original reproduction
:(x -> id)now throwsUndefVarError(:id, ..., Main)instead of returning(0x7596…, …).Groups run locally (Julia 1.12.4)
GROUP=Core julia --project -e 'using Pkg; Pkg.test()'— passed. Tail:GROUP=QA julia --project -e 'using Pkg; Pkg.test()'— passed:QA | 20 20 51.4s.julia --project=@runic -m Runic --inplaceon both changed files;typosclean.Not verified: julia lts (1.10) and
pre, non-Linux platforms, and the 32-bit lane — CI covers those. A user argument namedˍ₋rgf₋argscould in principle still collide with the splat name, but that is the pre-existing hygiene convention and not introduced here.Reviewer pushback welcome on: whether
generated_callfunc_body's own parameter names should also be hygienic for consistency (they are internal and not in scope of the generated body), and whether the testset placement next to the other globals tests incore_tests.jlis right.Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
@generatedgenerated_callfuncthatinit(mod)evals into each user module (argnames,cache_tagandidbecomeˍ₋rgf₋*). The method signature type is unchanged and there is no public API change; precompile caches invalidate on a version bump as usual.:(x -> id)now throwsUndefVarErrorinstead of returning the internal id. Symbolics 7.41.1build_functionsmoke tests pass (scalar, out-of-place, in-place). The Core and QA groups pass locally.id(which previously failed with a syntax error) and a shorter comment; both were sent back to the author.🤖 Generated with Devin CLI 3000.11.3 (model: swe-2-high), transcript /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-RuntimeGeneratedFunctions.jl-34/log.txt on amdci2.julia.csail.mit.edu
Risk assessment and review coordination by 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01NdFVhANTF4nepTbqYxjfRP