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
Many false negatives in behaviors involving an aggregate that starts empty, is later mutated, and is finally returned #5749
It's not hard to spot what is the type error there - I would have guessed that Pyrefly in its default configuration would flag such a function. Is this a shortcoming, or am I not understanding what kinds of problems Pyrefly is intended to solve, such that it needs implicit-any-empty-container and/or a type annotation on the first appearance of found in order to see and alert that there is an invalidity in this code? (I happen to be coming to Pyrefly from pytype, so that may color my expectations somewhat.)
This bug report exposes a number of gaps in partial type inference. A lot of them have to do with cycle handling restrictions we put in place intentionally: partial types have to be pinned by exactly one binding, and for various reasons if the read flows through a LoopPhi which might involve reassignment (for example through +=)
I think now that we have a fixpoint, it may be possible to relax some of these restrictions. But I do want to make it clear to anyone who picks this up that
this is one issue but should not be one PR, the different cases flagged are separate fixes; you might want to split this issue up before working on a PR
the fixes may be nontrivial to ship. It's possible this should be left to a Pyrefly contributor to eventually pick up
cc @QEDady if you really want to dig into Pyrefly internals, this might be an interesting one to chip away on, I'm guessing it came up in a google codebase.
Activity
stroxler commentedon Nov 25, 2026
This bug report exposes a number of gaps in partial type inference. A lot of them have to do with cycle handling restrictions we put in place intentionally: partial types have to be pinned by exactly one binding, and for various reasons if the read flows through a LoopPhi which might involve reassignment (for example through
+=)I think now that we have a fixpoint, it may be possible to relax some of these restrictions. But I do want to make it clear to anyone who picks this up that
cc @QEDady if you really want to dig into Pyrefly internals, this might be an interesting one to chip away on, I'm guessing it came up in a google codebase.