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

Improve empty collection handling with next #12065

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

max-muoto
Copy link
Contributor

Fixes #12064.

@JelleZijlstra
Copy link
Member

This doesn't seem right; it potentially leaves the type variable unsolved.

This comment has been minimized.

@max-muoto max-muoto marked this pull request as draft May 30, 2024 16:30
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

werkzeug (https://github.com/pallets/werkzeug)
- tests/test_test.py:757: note:     def [_T, _VT] next(SupportsNext[_T], _VT, /) -> _T | _VT
+ tests/test_test.py:757: note:     def [_T] next(SupportsNext[_T], _T, /) -> _T

operator (https://github.com/canonical/operator)
- ops/main.py:194: error: Argument 2 to "next" has incompatible type "None"; expected "Storage"  [arg-type]
+ ops/main.py:194: error: Incompatible types in assignment (expression has type "Storage | None", variable has type "Storage")  [assignment]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/operations/udf.py:41: note:     def [_T, _VT] next(SupportsNext[_T], _VT, /) -> _T | _VT
+ ibis/expr/operations/udf.py:41: note:     def [_T] next(SupportsNext[_T], _T, /) -> _T

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/app_session.py:424:20: error: Argument 1 to "filter" has incompatible type "Callable[[Any], bool]"; expected "Callable[[str], TypeGuard[Optional[str]]]"  [arg-type]
+ lib/streamlit/runtime/app_session.py:424:36: error: Invalid index type "Optional[str]" for "Dict[str, Dict[str, str]]"; expected type "str"  [index]

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.

Empty Collection Handling with next
2 participants