ruff/crates/red_knot_python_semantic/src
Shaygan Hooshyari 924741cb11
[red-knot] Infer unary not operation for instances (#13827)
Handle unary `not` on instances by calling the `__bool__` dunder.

## Test Plan

Added a new test case with some examples from these resources:

- https://docs.python.org/3/library/stdtypes.html#truth-value-testing
- <https://docs.python.org/3/reference/datamodel.html#object.__len__>
- <https://docs.python.org/3/reference/datamodel.html#object.__bool__>

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
2024-11-13 23:31:36 +00:00
..
module_resolver Enable nursery rules: 'redundant_clone', 'debug_assert_with_mut_call', and 'unused_peekable' (#13920) 2024-10-25 09:46:30 +02:00
semantic_index [red-knot] Handle invalid assignment targets (#14325) 2024-11-13 20:50:39 +01:00
types [red-knot] Avoid panics for ipython magic commands (#14326) 2024-11-13 20:58:08 +01:00
util [red-knot] Improve ergonomics for the PySlice trait (#13983) 2024-10-29 20:40:59 +00:00
ast_node_ref.rs Enable nursery rules: 'redundant_clone', 'debug_assert_with_mut_call', and 'unused_peekable' (#13920) 2024-10-25 09:46:30 +02:00
db.rs Rename the ruff_vendored crate to red_knot_vendored (#13586) 2024-10-01 16:16:59 +01:00
lib.rs Cached inference of all definitions in an unpacking (#13979) 2024-11-04 17:11:57 +05:30
module_name.rs [red-knot] Add support for relative imports (#12910) 2024-08-16 12:35:27 +01:00
node_key.rs [red-knot] Use memory address as AST node key (#14317) 2024-11-13 14:35:54 +01:00
program.rs Eagerly validate typeshed versions (#12786) 2024-08-21 15:49:53 +00:00
python_version.rs Add Python version support to ruff analyze CLI (#13426) 2024-09-20 15:40:47 -04:00
semantic_index.rs fix double inference of standalone expressions (#14107) 2024-11-05 15:50:31 +01:00
semantic_model.rs [red-knot] Remove Type::Unbound (#13980) 2024-10-31 20:05:53 +01:00
site_packages.rs Use backticks for code in red-knot messages (#13599) 2024-10-02 03:14:28 +00:00
stdlib.rs [red-knot] Infer Literal types from comparisons with sys.version_info (#14244) 2024-11-11 13:58:16 +00:00
symbol.rs [red-knot] Symbol API improvements, part 2 (#14276) 2024-11-11 15:24:27 +01:00
types.rs [red-knot] Infer unary not operation for instances (#13827) 2024-11-13 23:31:36 +00:00
unpack.rs Remove AST-node dependency from FunctionType and ClassType (#14087) 2024-11-05 08:02:38 +00:00