ruff/crates/red_knot_python_semantic/src
David Peter a255d79087
[red-knot] is_subtype_of fix for KnownInstance types (#14750)
## Summary

`KnownInstance::instance_fallback` may return instances of supertypes.
For example, it returns an instance of `_SpecialForm` for `Literal`.
This means it can't be used on the right-hand side of `is_subtype_of`
relationships, because it might lead to false positives.

I can lead to false negatives on the left hand side of `is_subtype_of`,
but this is at least a known limitation. False negatives are fine for
most applications, but false positives can lead to wrong results in
intersection-simplification, for example.

closes #14731

## Test Plan

Added regression test
2024-12-03 12:03:26 +01:00
..
module_resolver Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
semantic_index Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
types [red-knot] Simplify tuples containing Never (#14744) 2024-12-03 08:28:36 +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 Workspace discovery (#14308) 2024-11-15 19:20:15 +01:00
python_version.rs [red-knot] Default to python 3.9 (#14429) 2024-11-18 11:27:40 +00:00
semantic_index.rs fix double inference of standalone expressions (#14107) 2024-11-05 15:50:31 +01:00
semantic_model.rs [red-knot] Simplify some traits in ast_ids.rs (#14379) 2024-11-16 17:22:23 +00:00
site_packages.rs Workspace discovery (#14308) 2024-11-15 19:20:15 +01: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] is_subtype_of fix for KnownInstance types (#14750) 2024-12-03 12:03:26 +01:00
unpack.rs Remove AST-node dependency from FunctionType and ClassType (#14087) 2024-11-05 08:02:38 +00:00