objectmodel: fix crash analyzing property fset in generic classes with type annotations (#2997)
* objectmodel: fix AnnAssign has no attribute 'name'
The `find_setter` function previously searched through all child nodes looking for nodes with a name matching the property function, then checked for `.setter` decorators. This caused a crash when encountering `AnnAssign` nodes (like type hints) which don't have a 'name' attribute.
Instead, search only through `FunctionDef` and `AsyncFunctionDef` nodes in the class body, checking their decorators directly. This is more semantically correct (setters are always functions) and avoids the crash on non-function nodes.
Fixes #2996.
(cherry picked from commit a59574c3fd3c7a67b68f4aaede4b9b9f8154495b)
4 files changed