Skip to content

fix Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0]) #3265#4227

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:3265
Open

fix Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0]) #3265#4227
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:3265

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3265

Prevented bounded generic Any from incorrectly contextually typing list literals.

Test Plan

add test

@github-actions

Copy link
Copy Markdown

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

cki-lib (https://gitlab.com/cki-project/cki-lib)
- ERROR cki_lib/metrics/server.py:23:12-24: Returned type `Iterator[Any]` is not assignable to declared return type `None` [bad-return]
+ ERROR cki_lib/metrics/server.py:23:12-24: Returned type `Iterator[Unknown]` is not assignable to declared return type `None` [bad-return]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0])

1 participant