Skip to main content

flip_comparison_binop

Function flip_comparison_binop 

Source
pub fn flip_comparison_binop(expr: &Spanned<Expr>) -> Option<Spanned<Expr>>
Expand description

Flip a comparison BinOp to its logical negation so a caller’s match (a OP b) { false -> ... } arm normalises into a positive predicate. Returns None for non-comparison operators (Add, Sub, etc.) — those can’t legally land as a match … { Bool -> ... } subject anyway. Used by the issue-84 caller-guard extractor so every collected predicate is the same Spanned<Expr> shape opaque types and verify when already use, avoiding a parallel (expr, negated) representation.