fix(UnusedVariable): recognize destructured lambda parameters as used#9015
Merged
Conversation
…#8942) Destructured lambda parameters (e.g., `forEach { (a, b) -> }`) were incorrectly flagged as unused even when they were used in the lambda body. Changed to use KaVariableSymbol instead of KaLocalVariableSymbol to properly resolve references to destructured parameters. https://claude.ai/code/session_017k8v2kYDUuqB72jZ76Hmvf
The lambda parameters need explicit types for the Kotlin compiler to infer the types correctly. This fixes the compilation error in the test. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9015 +/- ##
============================================
+ Coverage 85.11% 85.14% +0.02%
Complexity 4380 4380
============================================
Files 569 569
Lines 12249 12255 +6
Branches 2643 2642 -1
============================================
+ Hits 10426 10434 +8
Misses 676 676
+ Partials 1147 1145 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
schalkms
approved these changes
Jan 28, 2026
BraisGabin
approved these changes
Jan 28, 2026
Member
BraisGabin
left a comment
There was a problem hiding this comment.
LGTM but I think that the comment is not needed.
…edVariable.kt Co-authored-by: Brais Gabín <braisgabin@gmail.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.
Summary
Changes
UnusedVariable.ktto recognize destructured lambda parameters as usedUnusedVariableSpec.ktto verify the fixTest plan
Fixes #8942
🤖 Generated with Claude Code