Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Description
Bug Report
When unpacking acustom iterable class to build another iterable, mypy does not correctly infer the resulting type i.e.CustomIter[CustomIter[_T]] is equal toCustomIter[_T] (that should not be true)
To Reproduce
Expected Behavior
Nested iterable unpacking type checking works fine when using standard types (e.g. list[list[_T]]) however custom iterable classes should have the same behavior.
Actual Behavior
As presented on the playground proof-of-concept the issue is that mypydoes not mark the failure on this incorrectly defined function:
def case_1(iter_of_iter: CustomIter[list[int]]) -> CustomIter[int]: # Mypy fails # # Mypy does not flag that the return type does not match. # It is `CustomIter[list[int]]` instead of `CustomIter[int]` return CustomIter.new(*iter_of_iter)Your Environment
- details available on the playground example.