Repository navigation
fix(join): signature join point miscounts parameters declared with a shared type - #964
Merged
Merged
Conversation
…shared type The signature option compared the number of expected types to the number of fields in the parameter and result lists. A field that names several parameters, such as the a, b in func(a, b string), is a single field, so signature args [string, string] never matched that function while args [string] matched it. Count one type per declared name instead, for both arguments and results.
darccio
requested changes
Nov 24, 2026
darccio
approved these changes
Nov 25, 2026
Contributor
Author
|
Really appreciate the thorough review on this one. Your point about the nil field lists and the combined signature cases made the tests far more honest than what I first sent, and it's great to see the grouped parameter fix land. Thanks for taking the time. |
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.
What does this PR do?
Fixes the
signaturejoin point so it counts one type per declared name when it compares a function against the expectedargsandreturns.The matcher compared
len(expected)to the number of fields in the parameter list. Go groups names that share a type into one field, sofunc(a, b string)has a single field. Withargs: [string, string]the aspect never matched that function, and withargs: [string]it matched it by mistake. Named results such as(x, y int)had the same problem.The change expands each field into one entry per name (or one for an unnamed field) before comparing, in order.
Motivation
An aspect that selects functions by an exact signature silently skipped any function whose parameters share a type, and could pick up functions with more parameters than it asked for.
Testing
Added
TestSignatureEvaluate, which covers grouped parameters, grouped named results, mixed grouped and separate parameters, ordering and unnamed parameters. The grouped cases fail without the change.go test -race ./internal/injector/...andgolangci-lint runpass.