Open nickdrozd opened 1 year ago
Similar in spirit to https://github.com/python/mypy/issues/13613
The stack trace makes it look like the problem is just with building the class mapping incorrectly. That can be fixed easily, but beyond that there is also a codegen problem that is not so straightforward.
For anyone following According to https://mypyc.readthedocs.io/en/latest/differences_from_python.html#conditional-functions-or-classes:
Function and class definitions guarded by an if-statement are not supported.
Even if it's unsupported, mypy should show a clear error message instead of crashing. A crash is always a bug.
To Reproduce
(This example is silly, but a real use case would be defining a protocol inside a
TYPE_CHECKING
block.)Actual Behavior