forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Red Knot - Infer the return value of bool() (astral-sh#13538)
## Summary Following astral-sh#13449, this PR adds custom handling for the bool constructor, so when the input type has statically known truthiness value, it will be used as the return value of the bool function. For example, in the following snippet x will now be resolved to `Literal[True]` instead of `bool`. ```python x = bool(1) ``` ## Test Plan Some cargo tests were added.
- Loading branch information
Showing
2 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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