facebook / facebook/pyrefly

`non-exhaustive-match` only works on equality checks

Open
#3,722 0 comments 0 reactions 0 assignees View on GitHub
scoping-control-flow typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

```python
def fn(value: int|str):
match value: # no error
case int():
...
```

according to [the docs](`non-exhaustive-match` only works on equality checks) it only works on enums? though it also seems to work on `Literal`s.

[pyright's `reportMatchNotExhaustive` rule reports an error here](https://basedpyright.com/?pyrightVersion=1.39.5&typeCheckingMode=all&code=CYUwZgBGB2AUBuBDANgVxALggS2gFwB8BnPAJwEoMBYAKAnogFtE8BjACwiTU1of4itEREDnyxKfAdIB0coA)

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABGOgBQBuqUArjIjROgC4A%2BcXgCcAlIgA6wiehpyaAW1S8AxgAsaLdpxoBiGulw0Yw4bmnTZ86ytRwY3Pg3FSZ19-MJeQAGhBlhaihSQl5cBSgKfQAFUkCwYJo0LDx8GhVcdEgAczZhZQhMwhl9AGUYBzVeXmI4RAB6eoCgkPNs%2Bph0esxcFTh6jKyIXPzeQq66cxpUFmhUbFh0zJy8gsyaXGIxzLhi9DJeNUyAWiYTOHGaAF4aCRAAZkIARgAmO5kAbRMzYTgAXRkbHQEAUxHMvBgmGOmAggRUYzO1xoAHJhoZAsiZIZeMdAgBHNiwyHHADWMFIx1QKhU8DgSORAHdUMJ0JjgaCoBAVBAcRhSPTvuY2TB8MROdzeeh%2BTdkYLhGyQWKuTzgtDqDxicoRBBsGwIQLTELAeg2PYoWjzA4ZUyWWygYEqWp5otrczWSAAL5%2BKkImAAMWgMAoyRwBBI5A9QA

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.