ruff/crates/ty_python_semantic
Douglas Creager baadb5a78d
[ty] Add some additional type safety to CycleDetector (#19903)
This PR adds a type tag to the `CycleDetector` visitor (and its
aliases).

There are some places where we implement e.g. an equivalence check by
making a disjointness check. Both `is_equivalent_to` and
`is_disjoint_from` use a `PairVisitor` to handle cycles, but they should
not use the same visitor. I was finding it tedious to remember when it
was appropriate to pass on a visitor and when not to. This adds a
`PhantomData` type tag to ensure that we can't pass on one method's
visitor to a different method.

For `has_relation` and `apply_type_mapping`, we have an existing type
that we can use as the tag. For the other methods, I've added empty
structs (`Normalized`, `IsDisjointFrom`, `IsEquivalentTo`) to use as
tags.
2025-08-13 17:32:35 -04:00
..
resources [ty] Add precise inference for indexing, slicing and unpacking NamedTuple instances (#19560) 2025-08-13 15:19:44 +00:00
src [ty] Add some additional type safety to CycleDetector (#19903) 2025-08-13 17:32:35 -04:00
tests [ty] Track open files in the server (#19264) 2025-07-18 19:33:35 +05:30
build.rs
Cargo.toml [ty] Avoid overcounting shared memory usage (#19773) 2025-08-06 15:32:02 -04:00
mdtest.py
mdtest.py.lock