@@ -1927,22 +1927,21 @@ def _check_consumer(
1927
1927
1928
1928
# Skip postponed evaluation of annotations
1929
1929
# and unevaluated annotations inside a function body
1930
+ # as well as TypeAlias nodes.
1930
1931
if not (
1931
- self ._postponed_evaluation_enabled
1932
+ self ._postponed_evaluation_enabled # noqa: RUF021
1932
1933
and (
1933
1934
isinstance (stmt , nodes .AnnAssign )
1934
- or (
1935
- isinstance (stmt , nodes .FunctionDef )
1936
- and node
1937
- not in {
1938
- * (stmt .args .defaults or ()),
1939
- * (stmt .args .kw_defaults or ()),
1940
- }
1941
- )
1935
+ or isinstance (stmt , nodes .FunctionDef ) # noqa: RUF021
1936
+ and node
1937
+ not in {
1938
+ * (stmt .args .defaults or ()),
1939
+ * (stmt .args .kw_defaults or ()),
1940
+ }
1942
1941
)
1943
- ) and not (
1944
- isinstance (stmt , nodes .AnnAssign )
1942
+ or isinstance (stmt , nodes .AnnAssign ) # noqa: RUF021
1945
1943
and utils .get_node_first_ancestor_of_type (stmt , nodes .FunctionDef )
1944
+ or isinstance (stmt , nodes .TypeAlias )
1946
1945
):
1947
1946
self .add_message (
1948
1947
"used-before-assignment" ,
@@ -2018,7 +2017,7 @@ def _report_unfound_name_definition(
2018
2017
if (
2019
2018
self ._postponed_evaluation_enabled
2020
2019
and utils .is_node_in_type_annotation_context (node )
2021
- ):
2020
+ ) or utils . is_node_in_pep695_type_context ( node ) :
2022
2021
return False
2023
2022
if self ._is_builtin (node .name ):
2024
2023
return False
0 commit comments