Using mypy 0.4.6.
repro.py:
import pathlib
file_dir = pathlib.Path(__file__).parent
def some_file() -> pathlib.Path:
return file_dir / 'foo.txt'
if __name__ == '__main__':
print(str(some_file()))
output:
$ python3 repro.py
foo.txt
$ mypy repro.py
repro.py: note: In function "some_file":
repro.py:8: error: Unsupported left operand type for / (Callable[[], Path])
Using mypy 0.4.6.
repro.py:
output: