mypy
051ed611 - Report incompatible assignments for descriptors with overloaded __set__ methods (#9893)

Commit
5 years ago
Report incompatible assignments for descriptors with overloaded __set__ methods (#9893) An assertion expected the second result of method `ExpressionChecker.check_call` to be a `CallableType`, but it is `AnyType` in the situation causing the crash. Hence, this commit replaces this assertion by handling both types differently. This involves modifying the second invocation of method `ExpressionChecker.check_call` a little to make sure it reports the invalid assignment in both cases. The new test case `testSettingDescriptorWithOverloadedDunderSet1` deals with overloading the value argument only and `testSettingDescriptorWithOverloadedDunderSet2` deals with overloading both the instance and the value argument.
Author
Parents
Loading