New semantic analyzer: fix daemon crash during AST strip (#6916)
Fix occasional crash when method and top level are updated at
the same time.
Stripping the top level removes attributes from class symbol
table. Previously we could process a method after stripping and
infer that initialization happens in the wrong place, resulting
in two initializers for a single attribute. This could result in the
same attribute being stripped twice, which causes a KeyError.
This fixes the issue by re-applying removed attributes before
processing any methods. There is an extra complication in that
if we re-process a method that defines an attribute, we can't
re-apply that attribute as the type could change. Added logic
to handle that by filtering out saved attributes when their
initialization assignment is stripped. I changed the data
structure used for this away from a list of patch functions to
something that allows us to examine the data about saved
attributes.
Fixes #6914.