ruff
baadb5a7 - [ty] Add some additional type safety to `CycleDetector` (#19903)

Commit
51 days ago
[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.
Author
Parents
Loading