-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Apologies for the apparently-convoluted test case. I've found it to be surprisingly fragile.
class InitiallyUnowned:
...
class Bin("Widget"):
...
class Dialog("Window"):
...
class FontSelectionDialog("Dialog"):
parent_instance = ... # type: "Dialog"
class Widget("InitiallyUnowned"):
parent_instance = ... # type: "InitiallyUnowned"
class Window("Bin"):
...which, when type-checking the stubs themselves gives:
sample.pyi:16: error: Incompatible types in assignment (expression has type "Dialog", base class "Widget" defined the type as "InitiallyUnowned")
The error appears to be highly order- and hierarchy-dependent.
If Dialog is declared after FontSelectionDialog, the bug goes away.
If Dialog subclasses Bin instead of Window, the bug goes away.
If Window subclasses Widget instead of Bin, the bug goes away.
It's probably worth mentioning that these are auto-generated stubs for GTK+/GObject introspection classes, so just manually adjusting ordering, etc. isn't really a good solution.
What is the behavior/output you expect?
No error.
What are the versions of mypy and Python you are using?
Python 3.6.7, mypy 0.650
Do you see the same issue after installing mypy from Git master?
Yes.
What are the mypy flags you are using? (For example --strict-optional)
No flags. This is just type-checking the stubs themselves.