-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
When type checking the following two files, the revealed type is unicode
though I'd expect str
-- but only when using -2 --no-strict-optional
:
# t.py
from typing import Optional
from m import relpath
a = '' # type: Optional[str]
reveal_type(relpath(a)) # unicode
# m.py
from typing import overload
@overload
def relpath(path: str) -> str: ...
@overload
def relpath(path: unicode) -> unicode: ...
The issue also happens with os.path.relpath
.
To reproduce:
$ mypy -2 --no-strict-optional t.py
t.py:4: error: Revealed type is 'builtins.unicode'
The issue seems to be related to using an optional type in a file which doesn't use strict optional checking.