You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fragment generates a false positive, starting from #15913:
fromtypingimportoverload, AnyclassC:
@overloaddeff(self, e: str, **kwargs) ->str: ...
@overload# error: Overloaded function signature 2 will never be matched: signature 1's# parameter type(s) are the same or broaderdeff(self, *args, **kwargs) ->Any: ...
deff(self, *args, **kwargs):
pass
The signature of item 2 is wider than item 1 due to accepting an arbitrary number of positional arguments and with arbitrary types, so this is a false positive.
This is one of those case when I ask myself how did this ever work, and it turns out it didn't. It turns out having (*args: Any, **kwargs: Any) as a fallback overload caused false positives almost always. So this is not really a regression, now mypy is consistently broken, LOL.
Anyway, the fix is in #16343, it turns out we never propagated is_proper_subtype flag to is_callable_compatible(). This is a major change, let's see how bad the fallout will be.
Fixes#16338
This is kind of a major change, but it is technically correct: we should
not treat `(*args: Any, **kwargs: Any)` special in `is_proper_subtype()`
(only in `is_subtype()`). Unfortunately, this requires an additional
flag for `is_callable_compatible()`, since currently we are passing the
subtype kind information via a callback, which is not applicable to
handling argument kinds.
This fragment generates a false positive, starting from #15913:
The signature of item 2 is wider than item 1 due to accepting an arbitrary number of positional arguments and with arbitrary types, so this is a false positive.
cc @ilevkivskyi
The text was updated successfully, but these errors were encountered: