Since #2380 was merged, the following example elicits an error when type-checked in Python 2 mode:
from typing import Iterator
class A: pass
class X(Iterator[A]):
def __next__(self):
# type: () -> A
pass
next = __next__
The error comes from the code added by #2380:
__tmp__.py: note: In class "X":
__tmp__.py:7: error: Incompatible types in assignment (expression has type Callable[[X], A], variable has type Callable[[Iterator[A]], A])
Since #2380 was merged, the following example elicits an error when type-checked in Python 2 mode:
The error comes from the code added by #2380: