-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
I have the following test case on mypy 0.521:
from typing import Generator, TypeVar
T = TypeVar('T')
def f(v: T) -> Generator[None, None, T]:
yield
return v
def g() -> Generator[None, None, None]:
# This works:
gen = f(1)
result_int = yield from gen
# This breaks:
result_int_2 = yield from f(1)
# I get
# mypy_bug.py:13: error: Function does not return a value
# mypy_bug.py:13: error: Argument 1 to "f" has incompatible type "int"; expected None
I expected this to type-check, but instead it complains on the last line. (I'm using strict-optional, although I don't think that is essential to this example)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong