We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test-mypy.py
from abc import ABCMeta, abstractmethod class A(metaclass=ABCMeta): @abstractmethod def foo(self) -> None: pass class B1(A, metaclass=ABCMeta): pass class B2(A, metaclass=ABCMeta): pass class C1(B1, B2): def foo(self) -> None: print("C1") class C2(B1, B2): def foo(self) -> None: print("C2") class Main: def __init__(self, b2: B2): self.b2: B2 = b2 def f(self) -> None: if isinstance(self.b2, C1): pass elif isinstance(self.b2, C2): pass else: assert False self.b2.foo() def g(self) -> None: b2 = self.b2 if isinstance(b2, C1): pass elif isinstance(b2, C2): pass else: assert False b2.foo() if __name__ == '__main__': Main(C1()).f() Main(C2()).f()
> mypy . Success: no issues found in 1 source file
> mypy . test-mypy.py:36: error: Never has no attribute "foo" [attr-defined] Found 1 error in 1 file (checked 1 source file)
Note that there is no such error in Main.g.
Main.g
mypy.ini
The text was updated successfully, but these errors were encountered:
No branches or pull requests
To Reproduce
test-mypy.py
Expected Behavior
Actual Behavior
Note that there is no such error in
Main.g
.Your Environment
mypy.ini
(and other config files): -The text was updated successfully, but these errors were encountered: