Tags: detekt/detekt
Tags
fix(UnusedImport): detect named companion objects correctly (#9005) * fix(UnusedImport): detect named companion objects correctly Previously, the rule only recognized companion objects with the default name "Companion" when determining if a class reference is used. This caused false positives when referencing classes with named companion objects (e.g., `CoroutineDispatcher` which has `companion object Key`). The fix uses `classKind == KaClassKind.COMPANION_OBJECT` to properly detect all companion objects regardless of their name. Fixes #8989 * refactor(UnusedImport): simplify companion object detection Use a when expression instead of intermediate variables. --------- Co-authored-by: Claude <noreply@anthropic.com>
PreviousNext