I'm doing a lot of PySide2 development in PyCharm (Professional 2020.3).
I have the stub files for PySide2 installed, which gives me quite good auto-completion, but somehow it doesn't detect unresolved references on some rather obvious cases.
See this screenshot:
When inheriting from any class that has an actual python definition, everything is fine, but when the parent class comes from a stub (pyi) file, it doesn't seem to detect that the reference is unresolved. Nowhere in the stub file self.missing is defined (and it happens with any name).
I have searched online for a while but all I can find are people complaining about pycharm flagging too many things as missing references, wherein this case it doesn't flag enough.
Are there special settings to set somewhere? Is it a subtlety of pyi files that need to be written differently? Or maybe a PyCharm bug?
As hinted by user2235698 in the comments, one of the stub objects (QObject) had reimplemented __getattr__
, which caused Pycharm to accept any attribute as correct.
Removing this line from the .pyi file sorted the issues.