Repository navigation
Conversation
A macro may interpolate an arbitrary value as the callee of a call in a method body, e.g. `$(QuoteNode(Offset(2.0)))(x)` where `Offset` is a callable struct. The call lowers to a `:call` whose callee is that `QuoteNode`, and `normalize_defsig` called `nameof` on its value. Only functions, types and modules have a `nameof`, so walking the body threw `MethodError: no method matching nameof(::Offset)` and Revise could not track the file (`Revise.SignatureExtractionError`), although `include` runs it fine. Call `nameof` only for a quoted function, type or module (the folded `const` callees JuliaInterpreter produces) and return any other quoted value as it is: it is not a name, so it is never a self-call. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GvfBWGxnUzWjHVUwWFLjCc
This branch has not been deployed
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.
My AI says I need this, but I haven't yet had time to review, uploaded this as an FYI only. Review at your own peril.
Upstream fix: Revise could not track a macro-generated method calling a quoted callable value (nameof MethodError in normalize_defsig). Reproducer, the change, tests on Julia 1.10.12 and 1.13.1. · Claude:remote-agents:snag.revise-signature-639b9c6d · claude-fable-5-1@xhigh
A macro may interpolate an arbitrary value as the callee of a call in a method body, e.g.
apply_offset(x) = $(QuoteNode(Offset(2.0)))(x)whereOffsetis a callable struct. The call lowers to a:callwhose callee is thatQuoteNode, andnormalize_defsigcallednameofon its value. Only functions, types and modules have anameof, so walking the body threw, and Revise could not track the file (Revise.SignatureExtractionError…caused by: MethodError: no method matching nameof(::Offset)) althoughincluderuns it fine. #149 fixed the same for a quotedSymbol; this is the remaining half.Reproducer
On LoweredCodeUtils 3.10.2 (
masterat 6f5c109), Julia 1.10.12, JuliaInterpreter 0.12.2:With this change,
methodinfosisDict(GlobalRef(Main, :apply_offset) => MethodInfo(2, 7, [1]))andselfcallsis empty. Through Revise 3.18.0,includetof a file holding that definition tracks it, and later edits of the macro argument, of the callable's body, and added or deleted generated methods are applied.Change
normalize_defsigcallsnameofonly when the quoted value is aFunction,DataType,UnionAllorModule(the kindsBase.nameofis defined for;Core.IntrinsicFunction <: Function), which keeps the foldedconstcallees JuliaInterpreter produces, and returns any other quoted value as it is: it is not a name, so it is never a self-call, and every caller already handles a result that is not aGlobalRef. A testset covers the callable-struct instance (plus an integer, a string and aUniontype), the function, type and module cases that still normalize, and walking and definingapply_offsetend to end.Tests pass on Julia 1.10.12 (185/185) and Julia 1.13.1 (205/205).
🤖 Generated with Claude Code
https://claude.ai/code/session_01GvfBWGxnUzWjHVUwWFLjCc