Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions test-data/unit/fine-grained.test
Original file line number Diff line number Diff line change
Expand Up @@ -5806,6 +5806,34 @@ class M(type):
==
a.py:2: error: Argument 1 to "f" of "M" has incompatible type "int"; expected "str"

[case testYieldFrom]
from typing import Iterator
from a import f

def g() -> Iterator[int]:
a = "string"
a = yield from f()

[file a.py]
from typing import Generator

def f() -> Generator[int, None, str]:
yield 5
return "ham"

[file a.py.2]
from typing import Generator

class A: pass

def f() -> Generator[int, None, A]:
yield 5
return A()

[out]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a test where f is turned into a normal function (just in case).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that this works but left the test out since this seems unlikely to break (to conserve test running times).

==
main:6: error: Incompatible types in assignment (expression has type "A", variable has type "str")

[case testFString]
from a import g
f'{g(1)}'
Expand Down