Skip to main content

operand_is_udvt

Function operand_is_udvt 

Source
fn operand_is_udvt<'hir>(gcx: Gcx<'hir>, expr: &Expr<'hir>) -> bool
Expand description

Returns true if expr’s type is a user-defined value type (UDVT).

A UDVT can only be compared through a user-defined operator (using {f as ==} for T global), which dispatches to an arbitrary function instead of built-in equality, so x == x is not guaranteed to be tautological. Built-in comparisons only apply to elementary types, so skipping UDVT operands removes that false positive without missing any real self-comparison. See https://soliditylang.org/blog/2023/02/22/user-defined-operators/.