-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
googleissues from googleissues from googleoverloadsscoping-control-flowissues related to scoping and control flowissues related to scoping and control flow
Milestone
Description
Describe the Bug
Here is an example of code that leads pyrefly to a false positive error:
def zip(*args):
return []
def f(a, b):
return reversed(zip(a, b))ERROR No matching overload found for function `reversed.__new__` called with arguments: (type[reversed[_T]], zip[tuple[@_, @_]] | Unknown) [no-matching-overload]
--> test.py:5:18
|
5 | return reversed(zip(a, b))
| ^^^^^^^^^^^
|
Possible overloads:
(cls: type[reversed[_T]], sequence: Reversible[_T], /) -> Iterator[_T] [closest match]
(cls: type[reversed[_T]], sequence: SupportsLenAndGetItem[_T], /) -> Iterator[_T]
INFO 1 error
This seems to have to do with shadowing the builtin zip name; if you replace zip with a differently-named function there is no error:
def _zip(*args):
return []
def f(a, b):
return reversed(_zip(a, b)) INFO 0 errors
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
googleissues from googleissues from googleoverloadsscoping-control-flowissues related to scoping and control flowissues related to scoping and control flow