Closed
Description
Given t-return.py
:
from typing import List
def getfoo():
return ["foo"]
def foo() -> List[str]:
return getfoo() # type: List[str]
mypy --show-column-numbers t-return.py
shows:
t-return.py:9:31: error: invalid syntax
Note that the reported column is the "i" in "List", which appears to be off in general.
The workaround is to split the return into an assignment (with the annotation), and then returning the variable. But I think it would be nice if the annotation would work with the return statement already.
If that's not going to be supported, the error should be more descriptive probably.
mypy 0.770+dev.9101707bd0c96624d09cb31fe573d7e25c89a35c.dirty
Metadata
Metadata
Assignees
Labels
No labels