Cannot import TYPE_CHECKING from `typing` / TYPE_CHECKING not ignored
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 603
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 6
Description
Python static analysis fails on some codon-specific code (i.e. u32, u64 used as types). An handy solution could be including for the type checkers a small section where necessary, like:
```
from typing import TYPE_CHECKING
if TYPE_CHECKING:
u64 = int
u32 = int
```
This should allow standard type checkers and static analysis to work decently with codon.
As of now, the above code results in the compilation error:
```
error: cannot import name 'TYPE_CHECKING' from 'typing'
```
A simple fix, I believe, would be adding `TYPE_CHECKING = False` in [typing](https://github.com/exaloop/codon/tree/master/stdlib/typing.codon)
EDIT: I am not sure the codon compiler skips entirely a block that is 100% sure not to be executed. If that's not the case, it might not be as easy :')
Contributor guide
Assessment
This issue has not been assessed yet.