Skip to content

Commit

Permalink
Let TypeAlias be a statement (#2250)
Browse files Browse the repository at this point in the history
Follow-up to fbcff3a.
  • Loading branch information
jacobtylerwalls authored Jul 15, 2023
1 parent d57dab2 commit 908c384
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion astroid/nodes/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4010,7 +4010,7 @@ def getitem(self, index, context: InferenceContext | None = None):
return _container_getitem(self, self.elts, index, context=context)


class TypeAlias(_base_nodes.AssignTypeNode):
class TypeAlias(_base_nodes.AssignTypeNode, _base_nodes.Statement):
"""Class representing a :class:`ast.TypeAlias` node.
>>> import astroid
Expand Down
2 changes: 2 additions & 0 deletions tests/test_type_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def test_type_alias() -> None:
assert node.inferred()[0] is node
assert node.type_params[0].inferred()[0] is node.type_params[0]

assert node.statement() is node


def test_type_param_spec() -> None:
node = extract_node("type Alias[**P] = Callable[P, int]")
Expand Down

0 comments on commit 908c384

Please sign in to comment.