[ty] remove static_expression_truthiness and improve reachability analysis#22971
Merged
carljm merged 1 commit intoastral-sh:mainfrom Jan 30, 2026
Merged
Conversation
Typing conformance resultsNo changes detected ✅ |
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
possibly-missing-attribute |
0 | 50 | 0 |
unresolved-attribute |
0 | 17 | 0 |
invalid-argument-type |
2 | 2 | 3 |
invalid-assignment |
0 | 3 | 4 |
invalid-parameter-default |
0 | 0 | 7 |
possibly-unresolved-reference |
0 | 7 | 0 |
invalid-return-type |
0 | 4 | 2 |
unused-type-ignore-comment |
0 | 2 | 0 |
call-non-callable |
0 | 1 | 0 |
unsupported-operator |
0 | 1 | 0 |
| Total | 2 | 87 | 16 |
AlexWaygood
approved these changes
Jan 30, 2026
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
The ecosystem results look great, thank you!
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
cf: #19579, #20566 (comment)
Currently, we use the query
static_expression_truthinessto determine the truthiness of an expression.This always determines the truthinesses of non-definitely-bound places as
Ambiguous, preventing cycles that occur when their reachabilities depend on themselves. However, this can lead to inaccurate analysis of code like the following.Since #20566, we can determine the
Placeby looking at the previous cycle result.Therefore, we can now remove
static_expression_truthiness, improving reachability analysis of the above code.Test Plan
mdtest updated