Closed vthemelis closed 1 month ago
Bug description
Pyre cannot reason about narrowing of literal types:
from typing import Literal, assert_never def foo(x: Literal["a", "b"]) -> str: if x == "a": return "a" if x == "b": return "b" else: assert_never(x)
This should obviously type check (and it does for pyright)
pyright
See Pyre playground
Thanks for reporting! This has been fixed in https://github.com/facebook/pyre-check/commit/58b242612f8e0e2f27c8ca40729b011d7e3edd26 and should be available in the next release.
Pyre Bug
Bug description
Pyre cannot reason about narrowing of literal types:
This should obviously type check (and it does for
pyright
)See Pyre playground