Conversation
When keyword argument defaults depend on other keyword arguments, JuliaLowering's `scope_nest` creates `:local` bindings in `let` blocks instead of `:argument` bindings. This caused the unused argument analysis to miss the connection between the `:argument` binding in the body method and the `:local` bindings where the keyword is actually used in default expressions. Three changes fix this: 1. Include `:argument` bindings in `same_location_bindings` unconditionally (not just for `@generated` functions), so they get unified with `:local` bindings at the same source location. 2. Extend `skip_arguments` in `compute_binding_occurrences!` to also skip `:local` bindings in self/kwsorter calls, preventing internal call machinery from being counted as genuine usage. 3. Add `has_matching_argument_binding` check in `analyze_unused_bindings!` to suppress duplicate `:local` diagnostics when a corresponding `:argument` binding exists at the same location. Closes #592 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #593 +/- ##
==========================================
- Coverage 67.88% 67.87% -0.01%
==========================================
Files 51 51
Lines 8295 8303 +8
==========================================
+ Hits 5631 5636 +5
- Misses 2664 2667 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
When keyword argument defaults depend on other keyword arguments, JuliaLowering's
scope_nestcreates:localbindings inletblocks instead of:argumentbindings. This caused the unused argument analysis to miss the connection between the:argumentbinding in the body method and the:localbindings where the keyword is actually used in default expressions.Three changes fix this:
:argumentbindings insame_location_bindingsunconditionally (not just for@generatedfunctions), so they get unified with:localbindings at the same source location.skip_argumentsincompute_binding_occurrences!to also skip:localbindings in self/kwsorter calls, preventing internal call machinery from being counted as genuine usage.has_matching_argument_bindingcheck inanalyze_unused_bindings!to suppress duplicate:localdiagnostics when a corresponding:argumentbinding exists at the same location.Closes #592