Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 13, 2017

Conversation

rowillia
Copy link
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
Copy link
Contributor

ambv commented Jan 13, 2017

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