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
Are you reporting a bug, or opening a feature request?
Bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
This is to tricky for mypy to understand. We may support this at some point, but I thin kit is relatively low priority. Se also #6641 which is quite similar.
maybe I'm mistaken, but i believe this might be a bug?
this only occurs in some cases; i don't understand the issue enough to describe which cases
one example i've seen is some definition of f like f = () -> Optional[str] which terminates with return A and A.b where A is some class, and b is some str attribute of A will result in an error indicating Incompatible return value type (got "Union[A, str]", expected "Optional[str]")
you know already that the correct type is Union[str, None]
also, this sometimes? works correctly with things like it: str = (A and A.b) or 'nice'
edit: some weird libs make their own falsey types; i.e. Union[Unset, T]...but don't support them, imo
(Sorry if the title is overly specific)
Bug
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
The inferred type of
org_name
at the last line isOptional[str]
(technicallyUnion[builtins.str, None]
).The type should be narrowed to
str
.Do you see the same issue after installing mypy from Git master?
Python 3.7.3
mypy: 0.701
No flags
The text was updated successfully, but these errors were encountered: