@@ -1947,22 +1947,21 @@ def _check_consumer(
19471947
19481948 # Skip postponed evaluation of annotations
19491949 # and unevaluated annotations inside a function body
1950+ # as well as TypeAlias nodes.
19501951 if not (
19511952 self ._postponed_evaluation_enabled
19521953 and (
19531954 isinstance (stmt , nodes .AnnAssign )
1954- or (
1955- isinstance (stmt , nodes .FunctionDef )
1956- and node
1957- not in {
1958- * (stmt .args .defaults or ()),
1959- * (stmt .args .kw_defaults or ()),
1960- }
1961- )
1955+ or isinstance (stmt , nodes .FunctionDef )
1956+ and node
1957+ not in {
1958+ * (stmt .args .defaults or ()),
1959+ * (stmt .args .kw_defaults or ()),
1960+ }
19621961 )
1963- ) and not (
1964- isinstance (stmt , nodes .AnnAssign )
1962+ or isinstance (stmt , nodes .AnnAssign )
19651963 and utils .get_node_first_ancestor_of_type (stmt , nodes .FunctionDef )
1964+ or isinstance (stmt , nodes .TypeAlias )
19661965 ):
19671966 self .add_message (
19681967 "used-before-assignment" ,
@@ -2034,7 +2033,7 @@ def _report_unfound_name_definition(
20342033 if (
20352034 self ._postponed_evaluation_enabled
20362035 and utils .is_node_in_type_annotation_context (node )
2037- ):
2036+ ) or utils . is_node_in_pep695_type_context ( node ) :
20382037 return
20392038 if self ._is_builtin (node .name ):
20402039 return
0 commit comments