Skip to content

Predicates: add visitor for typed predicates

Warren Gifford requested to merge cc/typed-predicate-visitor into main

Created by: camdencheek

This adds a visitor that yields typed predicates. We can do this because each predicate type is self-describing: it knows its own parent field, it knows its own name, and it knows how to unmarshal its own args. This was kinda what I had in mind all along, but the lack of generics made it infeasible.

For now, it's called VisitTypedPredicate, but I'll probably replaces uses of VisitPredicate over time and rename this VisitPredicate.

Test plan

Added test for RepoContainsFile, which is the only place that uses it right now.

Merge request reports

Loading