@@ -7578,7 +7578,8 @@ class that may be used later if the deprecated feature is used."""
75787578 overload = False
75797579 deprecation : str | None = None
75807580 for decorator in decorators :
7581- if (isinstance (typ , CallableType )
7581+ if (
7582+ isinstance (typ , CallableType )
75827583 and isinstance (decorator , NameExpr )
75837584 and (decorator .fullname in OVERLOAD_NAMES )
75847585 ):
@@ -7601,7 +7602,9 @@ class that may be used later if the deprecated feature is used."""
76017602 else :
76027603 typ .deprecated = f"{ name } is deprecated: { deprecation } "
76037604
7604- def check_deprecated (self , typ : CallableType | Overloaded | TypeInfo , context : Context ) -> None :
7605+ def check_deprecated (
7606+ self , typ : CallableType | Overloaded | TypeInfo , context : Context
7607+ ) -> None :
76057608 """Warn if deprecated and not directly imported with a `from` statement."""
76067609 if typ .deprecated is not None :
76077610 for imp in self .tree .imports :
@@ -7610,9 +7613,7 @@ def check_deprecated(self, typ: CallableType | Overloaded | TypeInfo, context: C
76107613 else :
76117614 self .warn_deprecated (typ , context )
76127615
7613- def warn_deprecated (
7614- self , typ : CallableType | Overloaded | TypeInfo , context : Context
7615- ) -> None :
7616+ def warn_deprecated (self , typ : CallableType | Overloaded | TypeInfo , context : Context ) -> None :
76167617 """Warn if deprecated."""
76177618 if (deprecated := typ .deprecated ) is not None :
76187619 warn = self .msg .fail if self .options .report_deprecated_as_error else self .msg .note
0 commit comments