Skip to content

Fix return type of next when default parameter is provided. - #827

Merged
ambv merged 1 commit into
python:masterfrom
rowillia:fix_default_next
Jan 13, 2017
Merged

ambv merged 1 commit into
python:masterfrom
rowillia:fix_default_next

Conversation

@rowillia

Copy link
Copy Markdown
Contributor

test_next.py:

z = (x*2 for x in range(10))
reveal_type(next(z, None))

Before:

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

After:

test_next.py:2: error: Revealed type is 'Union[builtins.int*, builtins.None]'

**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]'
```
@ambv

ambv commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

Based on what we did with get(), I think this is reasonable.

@ambv
ambv merged commit 41ba734 into python:master Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants