You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from typing import Optional, List
def is_not_none(lst):
# type: (Optional[List[str]]) -> bool
return lst is not None
def get_first_element(lst):
# type: (Optional[List[str]]) -> str
if is_not_none(lst):
return lst[0]
return 'not found'
mypy invocation: mypy --py2 .
Expected output:
Success: no issues found in 1 source file
Actual output
ex.py:12: error: Value of type "Optional[List[str]]" is not indexable
Found 1 error in 1 file (checked 1 source file)
The text was updated successfully, but these errors were encountered:
colinschoen
changed the title
Mypy incorrectly detecting type narrowing in another function
Mypy not detecting type narrowing in another function
Dec 31, 2019
mypy invocation:
mypy --py2 .
Expected output:
Actual output
The text was updated successfully, but these errors were encountered: