`unbound-name` does not consider exhaustiveness of `match ... case` correctly
Describe the Bug
from typing import assert_never, Literal
def func(x: Literal[1, 2]) -> None:
match x:
case 1:
y = 1
case 2:
y = 1
case _:
assert_never(x)
print(y)
ERROR sandbox.py:12:11-12: `y` may be uninitialized [[unbound-name](https://pyrefly.org/en/docs/error-kinds/#unbound-name)]
Python: 3.12
y is not undefined here :)
Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQCCiAOuvR-ZjGPWAK7pKACjgwoYADT18iehHQAXAJT0AtAD56AOVzoYcwkbbVaDAELDGy1u07deAoaPFT6AfTkKV6rbv2GxuggkiD8itBwJOSIIADE9ACqEVAQiqR8gpQRenBsbA58uABOALaoiu7o-KXYMMXCsvJKqpr0cIrFtpz0xTCK-MXsYCwg2jV1XfTA%2BAC%2Bo2whIGR9YFCkhIq4pVAUCQAKpKvr7Rg4BPSUepAA5oMVEHqEbAkAyjAw9AAWiorEcIgAPSAlY8daEEo3QEwdCAzC4ShwQFXdC3e45WFFYr0VAAN1Q0FQ2Fgl2uEDuxQeenouGIGKibDIii%2BejUuPqcEe7AAvPRRgBmQgARgATAtgrNQqhshB2QAxaAwChoLB4IhkECzIA
(Only applicable for extension issues) IDE Information
No response
Thanks for the bug report!
We're currently missing exhaustiveness on match entirely, it's tracked in https://github.com/facebook/pyrefly/issues/1286
This should be done before the V1 release
This is similar to https://github.com/facebook/pyrefly/issues/1518, but for literals instead of enums.