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 }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
I overstated; you're right, we could potentially merge those multiple assigns (without dataflow analysis). The returns work because we can find every type returned and do the union then (which is less complicated).
Jake Bailey (@jakebailey) the older analysis would collect types from both branches. So that later it could strengthen the union as in Union[XDerivedFromBase, YDerivedFromBase] -> Base. Is this now completely ignored within a single function body?
Currently, the new analysis doesn't do any sort of unioning or strengthening at all, other than the return type case I gave above. You can specify the type using a type annotation (so, say that something is Base explicitly), but we currently don't do anything special to handle multiple assignments over variables besides normal scoping rules.
Analysis no longer collects unions of possible combinations of values for performance and memory consumption reasons. Similarly, it no longer collects or stores all possible function return types with various arguments.
Activity
MikhailArkhipov commentedon Jun 3, 2019
New LS no longer collects combinations of types. In the example above a will be just
bool.lostmsu commentedon Jun 3, 2019
Mikhail Arkhipov (@MikhailArkhipov) out of curiosity: what would the new LS say about
ainjakebailey commentedon Jun 3, 2019
In that example,
list, because we take the final assign:You couldn't represent that code within the python
typingworld.However, we do handle something like this:
lostmsu commentedon Jun 3, 2019
Jake Bailey (@jakebailey) why not? What is the difference between
bandain this case? Why can'tabeUnion[str, list]?jakebailey commentedon Jun 3, 2019
I overstated; you're right, we could potentially merge those multiple assigns (without dataflow analysis). The returns work because we can find every type returned and do the union then (which is less complicated).
lostmsu commentedon Jun 3, 2019
Jake Bailey (@jakebailey) the older analysis would collect types from both branches. So that later it could strengthen the union as in
Union[XDerivedFromBase, YDerivedFromBase]->Base. Is this now completely ignored within a single function body?jakebailey commentedon Jun 3, 2019
Currently, the new analysis doesn't do any sort of unioning or strengthening at all, other than the return type case I gave above. You can specify the type using a type annotation (so, say that something is
Baseexplicitly), but we currently don't do anything special to handle multiple assignments over variables besides normal scoping rules.MikhailArkhipov commentedon Jun 3, 2019
Analysis no longer collects unions of possible combinations of values for performance and memory consumption reasons. Similarly, it no longer collects or stores all possible function return types with various arguments.