This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Type information incorrect when @cached methods are passed as parameters #16606
Open
Description
If a method that is wrapped in @cached
is passed into another function, e.g. run_in_background
then the type information is incorrect; the current mypy plugin only updates the type information when it is called as a method, not when it is accessed as an attribute.
E.g. from #16590:
synapse/push/bulk_push_rule_evaluator.py:359: error: Missing positional argument "room_id" in call to "run_in_background" [call-arg]
synapse/push/bulk_push_rule_evaluator.py:360: error: Argument 2 to "run_in_background" has incompatible type "str"; expected "RoomMemberWorkerStore" [arg-type]
The method is not getting treated as bound (and there might be other issues too).