quora / pyanalyze

A Python type checker
Apache License 2.0
340 stars 35 forks source link

pyanalyze does not do type narrowing at module level #743

Open hauntsaninja opened 8 months ago

hauntsaninja commented 8 months ago
import os

if os.altsep is not None:
    print(os.altsep + "asdf")

gives:

Unsupported operands for addition: None and Literal['asdf'] (code: unsupported_operation)
In b.py at line 4
   1: import os
   2: 
   3: if os.altsep is not None:
   4:     print(os.altsep + "asdf")