Open davfsa opened 3 years ago
I think the problem here is that the attrs plugin relies on subclasses of attrs classes being processed after any attrs classes they inherit from (we check if any of the base classes have been processed by the attrs plugin at https://github.com/python/mypy/blob/4c90aa42e6a74f127956124aec94f55dbc46a281/mypy/plugins/attrs.py#L371).
That seems to stop being true when compiling with mypyc because of the plugin mypyc uses to put all modules placed in a single mypyc group in the same SCC, because removing that plugin does appear to get rid of these errors.
Funny thing I found out too, if you try to reveal the type of the class that errors right before it is defined, it reveals the type correctly and works fine (the reveal type prevents it from compiling, as you would expect). Similarly, moving the class definition to any other file works too.
I recently tried using mypyc to speedup our python project, but I encountered this unfixable error that doesn't appear with strict mypy.
First reveal type is for
PartialGuild
before the inheritance and the second one is forInviteGuild
after the inheritance, note that all the attributes that should be inherited aren't there in the initThe interesting thing about this is that it only happens with this specific class inheritance, no other, and moving the class to a different file temporarily makes it work perfectly.
Code can be found here: https://github.com/davfsa/hikari/tree/69274b58b3c139872d9b051a65aac67dde378b14
I am sorry I haven't been able to provide a more consise example, as I have not been able to figure out what is going on nor reproduce it in any other environment.
Package versions
mypy/mypyc - 0.910 attrs - 21.2.0