Support Core.define_method builtin for method tracking - #2
Closed
Keno wants to merge 2 commits into
Closed
Conversation
Handle the upcoming `Core.define_method` builtin that will replace `Expr(:method)` in Julia's lowered code (JuliaLang/julia#60099). The existing `:method` handling is preserved for backward compatibility with older Julia versions. Changes: - Add `is_define_method_ref` helper for `categorize_stmt` - Update `_methods_by_execution!` to use `LoweredCodeUtils.ismethod()` and `methoddef!()` which now handle both `:method` and `define_method` forms - Handle sigdata lookup for 4-arg `define_method` (sigdata in args[4] vs args[2] for `:method`) - Convert `Core.LineInfoNode` to `LineNumberNode` for line number tracking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
Keep the legacy Expr(:method) path when the installed LoweredCodeUtils does not yet provide Core.define_method helpers. Delegate to the new APIs when available so Revise remains independently testable while preserving support for the upcoming lowering. CI: https://github.com/timholy/Revise.jl/actions/runs/29064509581 Co-authored-by: OpenAI Codex <codex@openai.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.
Julia's method-definition refactor introduces the
Core.define_methodbuiltin as the lowered form of method definitions (in place ofExpr(:method)in the affected lowering paths). This teaches Revise's statement categorization and method tracking to recognizedefine_methodcalls, delegating to the LoweredCodeUtils helpers (ismethod/is_define_method_ref/is_define_method_call_4arg) when available, with graceful fallback on older LoweredCodeUtils.This was staged pending releases of the supporting infrastructure, now available: LoweredCodeUtils 3.8.0 (JuliaDebug/LoweredCodeUtils.jl#160) and JuliaInterpreter ≥ 0.11.4 both ship
define_methodsupport.Independent of #1 (typegroup struct lowering): applies directly on top of v3.16.1, and the two touch disjoint concerns (method definitions vs type definitions).
Test plan: on a typegroup-enabled Julia build (1.14.0-DEV) with released LoweredCodeUtils 3.8.0 and current JuliaInterpreter master, the test-suite failure set of this branch is exactly identical to current master's on the same configuration (the shared failures are master's lack of typegroup struct support, addressed by #1; the union of both PRs previously passed the full suite). The JuliaInterpreter and LoweredCodeUtils suites covering the
define_methodmachinery pass upstream.🤖 This pull request was written with the assistance of generative AI (the branch commits carry their respective AI co-author trailers; this PR was prepared with Claude Fable 5).