Fix return type of next when default parameter is provided.

**test_next.py**:
```python
z = (x*2 for x in range(10))
reveal_type(next(z, None))
```

Before:
```shell
test_next.py:2: error: Revealed type is 'builtins.int*'
```

After:
```shell
test_next.py:2: error: Revealed type is 'Union[builtins.int*, builtins.None]'
```
This commit is contained in:
Roy Williams
2017-01-12 10:38:49 -08:00
committed by Łukasz Langa
parent fd4abe5fc3
commit 41ba734fc2
2 changed files with 2 additions and 2 deletions

View File

@@ -743,7 +743,7 @@ def min(iterable: Iterable[_T], key: Callable[[_T], Any] = ..., default: _T = ..
@overload
def next(i: Iterator[_T]) -> _T: ...
@overload
def next(i: Iterator[_T], default: _T) -> _T: ...
def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(i: int) -> str: ... # TODO __index__
if sys.version_info >= (3, 6):