ruff/crates/red_knot_python_semantic/src
Carl Meyer 149fb2090e
[red-knot] more efficient UnionBuilder::add (#13411)
Avoid quadratic time in subsumed elements when adding a super-type of
existing union elements.

Reserve space in advance when adding multiple elements (from another
union) to a union.

Make union elements a `Box<[Type]>` instead of an `FxOrderSet`; the set
doesn't buy much since the rules of union uniqueness are defined in
terms of supertype/subtype, not in terms of simple type identity.

Move sealed-boolean handling out of a separate `UnionBuilder::simplify`
method and into `UnionBuilder::add`; now that `add` is iterating
existing elements anyway, this is more efficient.

Remove `UnionType::contains`, since it's now `O(n)` and we shouldn't
really need it, generally we care about subtype/supertype, not type
identity. (Right now it's used for `Type::Unbound`, which shouldn't even
be a type.)

Add support for `is_subtype_of` for the `object` type.

Addresses comments on https://github.com/astral-sh/ruff/pull/13401
2024-09-20 10:49:45 -07:00
..
module_resolver Add a subcommand to generate dependency graphs (#13402) 2024-09-19 21:06:32 -04:00
semantic_index Fix/#13070 defer annotations when future is active (#13395) 2024-09-19 10:13:37 +02:00
types [red-knot] more efficient UnionBuilder::add (#13411) 2024-09-20 10:49:45 -07:00
ast_node_ref.rs Add definitions for match statement (#13147) 2024-09-02 14:40:09 +05:30
db.rs Add API to emit type-checking diagnostics (#12988) 2024-08-20 07:22:30 +00:00
lib.rs Add a subcommand to generate dependency graphs (#13402) 2024-09-19 21:06:32 -04:00
module_name.rs [red-knot] Add support for relative imports (#12910) 2024-08-16 12:35:27 +01:00
node_key.rs Implement AstNode for Identifier (#13207) 2024-09-02 16:27:12 +05:30
program.rs Eagerly validate typeshed versions (#12786) 2024-08-21 15:49:53 +00:00
python_version.rs Remove red_knot_python_semantic::python_version::TargetVersion (#12790) 2024-08-10 14:28:31 +01:00
semantic_index.rs Fix/#13070 defer annotations when future is active (#13395) 2024-09-19 10:13:37 +02:00
semantic_model.rs [red-knot] use declared types in inference/checking (#13335) 2024-09-17 08:11:06 -07:00
site_packages.rs Eagerly validate typeshed versions (#12786) 2024-08-21 15:49:53 +00:00
stdlib.rs [red-knot] support reveal_type as pseudo-builtin (#13403) 2024-09-19 07:58:08 -07:00
types.rs [red-knot] more efficient UnionBuilder::add (#13411) 2024-09-20 10:49:45 -07:00