@@ -714,7 +714,7 @@ def fix_function_overloads(self, stmts: list[Statement]) -> list[Statement]:
714714 current_overload .extend (if_block_with_overload .body [- 1 ].items )
715715 else :
716716 current_overload .append (
717- cast (Union [ Decorator , FuncDef ] , if_block_with_overload .body [0 ])
717+ cast (Decorator | FuncDef , if_block_with_overload .body [0 ])
718718 )
719719 else :
720720 if last_if_stmt is not None :
@@ -760,7 +760,7 @@ def fix_function_overloads(self, stmts: list[Statement]) -> list[Statement]:
760760 cast (list [IfStmt ], if_block_with_overload .body [:- 1 ])
761761 )
762762 last_if_overload = cast (
763- Union [ Decorator , FuncDef , OverloadedFuncDef ] ,
763+ Decorator | FuncDef | OverloadedFuncDef ,
764764 if_block_with_overload .body [- 1 ],
765765 )
766766 last_if_unknown_truth_value = if_unknown_truth_value
@@ -807,7 +807,7 @@ def _check_ifstmt_for_overloads(
807807 return None
808808
809809 overload_name = cast (
810- Union [ Decorator , FuncDef , OverloadedFuncDef ] , stmt .body [0 ].body [- 1 ]
810+ Decorator | FuncDef | OverloadedFuncDef , stmt .body [0 ].body [- 1 ]
811811 ).name
812812 if stmt .else_body is None :
813813 return overload_name
@@ -991,7 +991,7 @@ def do_func_def(
991991 self .errors , line = lineno , override_column = n .col_offset
992992 ).translate_expr_list (func_type_ast .argtypes )
993993 # Use a cast to work around `list` invariance
994- arg_types = cast (list [Optional [ Type ] ], translated_args )
994+ arg_types = cast (list [Type | None ], translated_args )
995995 return_type = TypeConverter (self .errors , line = lineno ).visit (func_type_ast .returns )
996996
997997 # add implicit self type
@@ -1646,7 +1646,7 @@ def visit_Call(self, n: Call) -> CallExpr:
16461646 self .visit (n .func ),
16471647 arg_types ,
16481648 arg_kinds ,
1649- cast ("list[Optional[ str] ]" , [None ] * len (args )) + keyword_names ,
1649+ cast ("list[str | None ]" , [None ] * len (args )) + keyword_names ,
16501650 )
16511651 return self .set_line (e , n )
16521652
0 commit comments