@@ -726,6 +726,7 @@ def _visit_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
726726 assert isinstance (item , Decorator )
727727 item_type = self .extract_callable_type (item .var .type , item )
728728 if item_type is not None :
729+ item_type .definition = item
729730 item_types .append (item_type )
730731 if item_types :
731732 defn .type = Overloaded (item_types )
@@ -3751,6 +3752,9 @@ def check_assignment_to_slots(self, lvalue: Lvalue) -> None:
37513752 return
37523753
37533754 inst = get_proper_type (self .expr_checker .accept (lvalue .expr ))
3755+ if isinstance (inst , TypeVarType ) and inst .id .is_self ():
3756+ # Unwrap self type
3757+ inst = get_proper_type (inst .upper_bound )
37543758 if not isinstance (inst , Instance ):
37553759 return
37563760 if inst .type .slots is None :
@@ -4927,17 +4931,7 @@ def visit_operator_assignment_stmt(self, s: OperatorAssignmentStmt) -> None:
49274931 inplace , method = infer_operator_assignment_method (lvalue_type , s .op )
49284932 if inplace :
49294933 # There is __ifoo__, treat as x = x.__ifoo__(y)
4930- rvalue_type , method_type = self .expr_checker .check_op (method , lvalue_type , s .rvalue , s )
4931- if isinstance (inst := get_proper_type (lvalue_type ), Instance ) and isinstance (
4932- defn := inst .type .get_method (method ), OverloadedFuncDef
4933- ):
4934- for item in defn .items :
4935- if (
4936- isinstance (item , Decorator )
4937- and isinstance (typ := item .func .type , CallableType )
4938- and (bind_self (typ ) == method_type )
4939- ):
4940- self .warn_deprecated (item .func , s )
4934+ rvalue_type , _ = self .expr_checker .check_op (method , lvalue_type , s .rvalue , s )
49414935 if not is_subtype (rvalue_type , lvalue_type ):
49424936 self .msg .incompatible_operator_assignment (s .op , s )
49434937 else :
@@ -7962,7 +7956,7 @@ def warn_deprecated(self, node: Node | None, context: Context) -> None:
79627956 node = node .func
79637957 if (
79647958 isinstance (node , (FuncDef , OverloadedFuncDef , TypeInfo ))
7965- and (( deprecated := node .deprecated ) is not None )
7959+ and (deprecated := node .deprecated ) is not None
79667960 and not self .is_typeshed_stub
79677961 and not any (
79687962 node .fullname == p or node .fullname .startswith (f"{ p } ." )
@@ -7972,21 +7966,6 @@ def warn_deprecated(self, node: Node | None, context: Context) -> None:
79727966 warn = self .msg .note if self .options .report_deprecated_as_note else self .msg .fail
79737967 warn (deprecated , context , code = codes .DEPRECATED )
79747968
7975- def warn_deprecated_overload_item (
7976- self , node : Node | None , context : Context , * , target : Type , selftype : Type | None = None
7977- ) -> None :
7978- """Warn if the overload item corresponding to the given callable is deprecated."""
7979- target = get_proper_type (target )
7980- if isinstance (node , OverloadedFuncDef ) and isinstance (target , CallableType ):
7981- for item in node .items :
7982- if isinstance (item , Decorator ) and isinstance (
7983- candidate := item .func .type , CallableType
7984- ):
7985- if selftype is not None and not node .is_static :
7986- candidate = bind_self (candidate , selftype )
7987- if candidate == target :
7988- self .warn_deprecated (item .func , context )
7989-
79907969 # leafs
79917970
79927971 def visit_pass_stmt (self , o : PassStmt , / ) -> None :
0 commit comments