-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
from __future__ import annotations
from typing import Any
class array: ...
def get_result() -> Any: ...
def foo(x: str | array) -> str:
result = get_result()
if isinstance(result, array):
return "asdf"
if result is x:
reveal_type(result) # N: Revealed type is "Any"
return result
raise
As of #20492 we now get 14: error: Incompatible return value type (got "str | array", expected "str")
I don't have a fix for this in my stack (and expect a fix to be tricky)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong