Files
openide/python/python-psi-impl
Mikhail Golubev a76592e754 PY-59795 PY-59727 Check assignment targets when inferring TypedDicts from dict modifications
Not doing it not only led to incorrect results, but also could cause serious
performance problems as in PY-59727 when we started recursively analyzing
assignments to a parent dict, producing gigantic hierarchies of nested
TypedDict types as a result.

Namely, each type we tried to infer a TypedDict for a dict literal
in the RHS of an assignment to another dict's key, like the following

d['key'] = {...}

we started to analyze all the modifications of "d" all over again, even though
they couldn't affect the type of the assigned literal. Doing that, we eventually
tried to infer the type of this literal again, and the recursion guard in
TypeEvalContext finally set off. But before that, we'd already constructed
a tree of TypedDicts with the depth roughly equal to the number of such
subscripted assignments to "d". For the user's example, such a TypedDict
contained millions of elements completely hanging our inspections.

GitOrigin-RevId: 5a17894d501086ed4d4ec6bdd8a17c1f05dd7bd5
2023-03-29 09:30:38 +00:00
..