You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0]) #3265
It doesn't look like this is fixed properly; list is fine now, but I can trivially produce another failure by using a set:
from typing import Iterator, assert_type
assert_type(iter({0}), Iterator[int]) # still fails
or a dict:
from typing import Iterator, assert_type
assert_type(iter({0: 0}), Iterator[int]) # still fails
I suppose we could extend 899b0af to other container types, but the fact that we're special-casing specific builtins - and even that commit introduces a bug= test and notes the fix is incomplete - makes me wonder if we're just working around the problem rather than solving the root case.
Activity
rchen152 commentedon May 6, 2026
Unassigning myself since I'm not actively working on this
asukaminato0721 commentedon Aug 29, 2026
899b0af
rchen152 commentedon Sep 9, 2026
It doesn't look like this is fixed properly; list is fine now, but I can trivially produce another failure by using a set:
or a dict:
I suppose we could extend 899b0af to other container types, but the fact that we're special-casing specific builtins - and even that commit introduces a
bug=test and notes the fix is incomplete - makes me wonder if we're just working around the problem rather than solving the root case.test: document container inference bugs with Any bounds (#5046)
Do not treat `Any` in type variable bounds as hints