Skip to content

Fix nested if statement dispatch not recognized (#294)#323

Merged
hakancelikdev merged 1 commit intomainfrom
fix/nested-if-dispatch-not-recognized
Feb 18, 2026
Merged

Fix nested if statement dispatch not recognized (#294)#323
hakancelikdev merged 1 commit intomainfrom
fix/nested-if-dispatch-not-recognized

Conversation

@hakancelikdev
Copy link
Copy Markdown
Owner

Recursively collect import names through nested ast.If blocks so that imports inside inner if/else (e.g. TYPE_CHECKING inside a version check) are recognized as part of the outer dispatch pattern.

Recursively collect import names through nested ast.If blocks in the
body branch so that imports inside inner if/else (e.g. TYPE_CHECKING
inside a version check) are recognized as part of the outer dispatch
pattern. The orelse branch uses flat collection to avoid breaking
elif chain handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hakancelikdev hakancelikdev force-pushed the fix/nested-if-dispatch-not-recognized branch from 4b6cfcb to 3739d65 Compare February 18, 2026 09:31
@hakancelikdev hakancelikdev merged commit 1a56d4c into main Feb 18, 2026
35 checks passed
@hakancelikdev hakancelikdev deleted the fix/nested-if-dispatch-not-recognized branch February 18, 2026 09:36
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.

Unimport does not work correctly when there is a nested if statement.

1 participant