Open
Description
This currently produces a bunch of false-positive errors:
$ python -m pyanalyze -c '''from typing import TypeVar
T = TypeVar("T", None, str)
def f(source: T) -> T:
if source is None:
return source
if source.startswith("x"):
return source[1:]
return source
'''
None has no attribute 'startswith' (code: undefined_attribute)
In <code> at line 6
3: def f(source: T) -> T:
4: if source is None:
5: return source
6: if source.startswith("x"):
^
7: return source[1:]
8: return source
<uninitialized> is not callable (code: not_callable)
In <code> at line 7
4: if source is None:
5: return source
6: if source.startswith("x"):
7: return source[1:]
^
8: return source
Metadata
Assignees
Labels
No labels
Activity