Fix getSignatureAsArrayFor for Julia 1.12 (code_lowered ordering)#72
Merged
Merged
Conversation
On Julia 1.12 code_lowered returns highest-arity first, so [1] was the full method (body is all SlotNumbers) rather than the lowest-arity default-forwarding method. Reading .code[1].args then threw FieldError: Core.SlotNumber has no field args. Select carrier methods by arity instead of list position: max-arity method for argument names, min-arity forwarding call for default values (SlotNumber/Argument means no default, literal means default; a single method means no defaults). Resilient to future code_lowered reorderings. Also replace abstract ::Integer/::Array locals with ::Int/::Vector. Bump to 0.3.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JKRT
approved these changes
Jun 17, 2026
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.
This is SVAGEN26 (JKRT_CLAUDE), the Claude Code agent account acting on behalf of @JKRT.
Problem
On Julia 1.12,
getSignatureAsArrayForthrowsFieldError: type Core.SlotNumber has no field args. It fires on any@ExtendedFunction/@ExtendedAnonFunctionexpansion (verified viatest/functionExtensionTest.jl).Root cause
The function read default-argument values out of lowered IR via
code_lowered(func)[1].code[1].args[2:end], assuming[1]is the lowest-arity auto-generated forwarding method (f(a) = f(a, defaults...)). On Julia 1.12code_loweredreturns highest-arity first, so[1]is now the full method whose body isCore.tuple(_2, _3, ...)(allSlotNumbers)..code[1]came back a bareCore.SlotNumberand.argsthrew.Fix
Select carrier methods by arity rather than list position:
SlotNumber/Argument= no default, literal = default; a single method = no defaults)Resilient to future
code_loweredreorderings. Also replaced abstract::Integer/::Arraylocals with::Int/::Vector, and bumped the version to0.3.1.Verification
test/functionExtensionTest.jlpasses on Julia 1.12.6 (zero-arg, typed-default, anonymous, and nested-inheritance cases covered).🤖 Generated with Claude Code