Open
Description
What is the bug?
Using v2.4.1, types on fields are not inferred correctly when setting from instance methods
How can one reproduce the bug?
a contrived example:
class MyDocument(Document):
myVal = Double()
def save(self, **kwargs):
# set default value for myVal
if not self.myVal:
self.myVal = 1
return super().save(**kwargs)
running mypy would yield:
error: Incompatible types in assignment (expression has type "int", variable has type "Double") [assignment]
What is the expected behavior?
no type error