Closed tusharsadhwani closed 8 months ago
I'm not enthusiastic about this because I want autotyping to remain a simple tool, not a type inference engine. I already help maintain two type checkers (pyanalyze and mypy) and that's plenty. Specifically the "or something like exit() or sys.exit()" information: doing that right requires us to look in typeshed or annotations to figure out which functions return Never.
Basic control flow can be implemented to remove all false positive cases where implicit
None
return may happen.The strategy
If
,While
andFor
nodes, to find all control flow paths inside a function definition.return
orraise
(or something likeexit()
orsys.exit()
), we assume that the function can return implicitly.seen_implicit_none_return
to state, and storing the information there.If it sounds good, I can try and implement exactly this.