Skip to content

Fix/type alias semantic kind - #263

Merged
pjljvandelaar merged 4 commits into
mainfrom
fix/type-alias-semantic-kind
Oct 9, 2026
Merged

pjljvandelaar merged 4 commits into
mainfrom
fix/type-alias-semantic-kind

Conversation

@pjljvandelaar

Copy link
Copy Markdown
Collaborator

fixes #262

PYTHON_KIND_MAP had no entry for TypeAlias, so a type alias statement fell through to SemanticKind.NODE on the ast-based backends. Recipes that select statements by semantic kind silently skipped type aliases.

Hypothesis found this through test_from_cst_returns_statement. The tree-sitter backend already reports type_alias_statement as a statement, so this also restores agreement between backends.

Added a deterministic test so the regression does not depend on Hypothesis rediscovering the input.
Enumerates all ast.stmt subclasses and fails when any falls through to SemanticKind.NODE, so a future grammar addition cannot slip through unclassified. Raises the S101 budget by one for the new assert. Solves issue 262.
@pjljvandelaar
pjljvandelaar requested a review from rcorvino October 8, 2026 14:56
@pjljvandelaar
pjljvandelaar merged commit 74dc0b8 into main Oct 9, 2026
10 checks passed
@pjljvandelaar
pjljvandelaar deleted the fix/type-alias-semantic-kind branch October 9, 2026 06:47
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.

PEP 695 type alias statements are classified as SemanticKind.NODE

1 participant