Skip to content

refactor: migrate avoid_unnecessary_type_assertions#282

Open
andrew-bekhiet-solid wants to merge 7 commits into
analysis_server_migrationfrom
271-migrate-avoid_unnecessary_type_assertions
Open

refactor: migrate avoid_unnecessary_type_assertions#282
andrew-bekhiet-solid wants to merge 7 commits into
analysis_server_migrationfrom
271-migrate-avoid_unnecessary_type_assertions

Conversation

@andrew-bekhiet-solid

Copy link
Copy Markdown
Collaborator

Fixes #271

@andrew-bekhiet-solid andrew-bekhiet-solid linked an issue Jun 9, 2026 that may be closed by this pull request

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the avoid_unnecessary_type_assertions lint rule and its associated quick fix to use the new AnalysisRule and ResolvedCorrectionProducer APIs. The logic is modularized into separate visitors for is expressions and whereType method invocations, and comprehensive unit tests are introduced. However, there are critical issues to address: first, the quick fix pattern matching on node will fail because node resolves to a leaf AST node, so thisOrAncestorOfType should be used instead. Second, the whereType visitor can crash with a StateError when encountering non-generic classes that implement Iterable, which requires safely extracting the type argument from the Iterable supertype. Finally, a test case should be added to verify this non-generic iterable scenario.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@andrew-bekhiet-solid andrew-bekhiet-solid force-pushed the 271-migrate-avoid_unnecessary_type_assertions branch from cd4001d to 27f6bcc Compare June 10, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate avoid_unnecessary_type_assertions

1 participant