Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Oct 16, 2024
1 parent ddeb5bd commit 1df9baf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test-data/unit/check-selftype.test
Original file line number Diff line number Diff line change
Expand Up @@ -2160,3 +2160,19 @@ class MyProtocol(Protocol):

def test() -> None: ...
value: MyProtocol = test

[case testSelfTypeUnionIter]
from typing import Self, Iterator, Generic, TypeVar, Union

T = TypeVar("T")

class range(Generic[T]):
def __iter__(self) -> Self: ...
def __next__(self) -> T: ...

class count:
def __iter__(self) -> Iterator[int]: ...

def foo(x: Union[range[int], count]) -> None:
for item in x:
reveal_type(item) # N: Revealed type is "builtins.int"

0 comments on commit 1df9baf

Please sign in to comment.