Skip to main content

validate_coercion

Function validate_coercion 

Source
pub fn validate_coercion(
    expr: &Expr,
    source: ExprType,
    target: ExprType,
) -> Result<(), TypeError>
Expand description

Validate that a coercion expression produces the expected target type when given a single input variable "v" of the specified source type.

ยงErrors

Returns TypeError::TypeMismatch if the inferred type does not match target (and the inferred type is not Any), or TypeError::UnboundVariable if the expression references variables other than "v".