[ty] reveal_type diagnostics in unreachable code#24070
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-await |
0 | 40 | 0 |
invalid-return-type |
0 | 1 | 0 |
| Total | 0 | 41 | 0 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
AlexWaygood
approved these changes
Mar 20, 2026
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
This looks great to me. I do think we need to do something about assert_type diagnostics in unreachable code -- see #24024 (comment) -- but we can discuss that separately
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In unreachable sections of code, we infer
Neverfor symbols that were define outside the unreachable part. This means, that we inferNeverfor thereveal_typesymbol here:This PR fixes that by explicitly detecting callables named
reveal_typethat have a type ofNever. I'm sure there ways to make this more bullet-proof, but it seems very unlikely that this will cause "false positives".I'm not sure if we should do something similar
assert_type/assert_never, but it seems to me like those are different. Instead of just revealing a potentially surprising type in unreachable code, those could accidentally look like they succeed when they shouldn't, or they could fail when they should appear to succeed.Test Plan
New Markdown tests.