ruff/crates/red_knot_python_semantic/resources/mdtest/directives
David Peter b662c3ff7e
[red-knot] Add support for assert_never (#17287)
## 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.
2025-04-08 09:31:49 +02:00
..
assert_never.md [red-knot] Add support for assert_never (#17287) 2025-04-08 09:31:49 +02:00
assert_type.md [red-knot] Add missing imports in mdtests (#15869) 2025-02-03 09:27:29 +00:00
cast.md [red-knot] Fix more [redundant-cast] false positives (#17170) 2025-04-03 15:00:00 +01:00