mirror of https://github.com/astral-sh/ruff
## Summary We already have partial "support" for `assert_never`, because it is annotated as ```pyi def assert_never(arg: Never, /) -> Never: ... ``` in typeshed. So we already emit a `invalid-argument-type` diagnostic if the argument type to `assert_never` is not assignable to `Never`. That is not enough, however. Gradual types like `Any`, `Unknown`, `@Todo(…)` or `Any & int` can be assignable to `Never`. Which means that we didn't issue any diagnostic in those cases. Also, it seems like `assert_never` deserves a dedicated diagnostic message, not just a generic "invalid argument type" error. ## Test Plan New Markdown tests. |
||
|---|---|---|
| .. | ||
| assert_never.md | ||
| assert_type.md | ||
| cast.md | ||