revset: ignore Present node when building backend expression

This will become safe as I'm going to add static check that the expression does
never contain CommitRef(_)s. We could make Present(_) unconstructible, but the
existence of Present node is harmless.
This commit is contained in:
Yuya Nishihara 2024-11-04 21:25:29 +09:00
parent e6ea88aac0
commit e83072b98f

View file

@ -2300,9 +2300,8 @@ impl VisibilityResolutionContext<'_> {
self.resolve(expression1).into(),
self.resolve(expression2).into(),
),
RevsetExpression::Present(_) => {
panic!("Expression '{expression:?}' should have been resolved by caller");
}
// present(x) is noop if x doesn't contain any commit refs.
RevsetExpression::Present(candidates) => self.resolve(candidates),
RevsetExpression::NotIn(complement) => ResolvedExpression::Difference(
self.resolve_all().into(),
self.resolve(complement).into(),
@ -2392,9 +2391,8 @@ impl VisibilityResolutionContext<'_> {
RevsetExpression::Coalesce(_, _) => {
ResolvedPredicateExpression::Set(self.resolve(expression).into())
}
RevsetExpression::Present(_) => {
panic!("Expression '{expression:?}' should have been resolved by caller")
}
// present(x) is noop if x doesn't contain any commit refs.
RevsetExpression::Present(candidates) => self.resolve_predicate(candidates),
RevsetExpression::NotIn(complement) => {
ResolvedPredicateExpression::NotIn(self.resolve_predicate(complement).into())
}