`assert_type` fails to fail for `NoReturn`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
In a case that mypy deems impossible (i.e. type narrowed to NoReturn), it's currently impossible to cause assert_type to fail.
Similarly, reveal_type has no effect in the case of NoReturn.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=10400960688da44ab22b58df6c297f50
Expected Behavior
Three assert_type failures.
Actual Behavior
Only one assert_type failure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked mypy-play reproduction and compare the three expected assert_type failures with the single actual failure. Trace how assert_type and reveal_type handle a type narrowed to NoReturn, then add regression coverage for this case. Done means all three assertions fail as expected and the corresponding reveal_type behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100