pub fn check_negation_operation(
context: &CompilationContext,
unary_expr: &UnaryExpr,
operand_type: &TypeId,
) -> SemanticResult
Expand description
Checks if arithmetic negation (-) is valid for the given operand type. Supports signed integers, floats, and unspecified numeric literals. Unsigned integers cannot be negated.
§Arguments
context
- The compilation contextunary_expr
- The unary negation expressionoperand_type
- The type of the operand
§Returns
Ok(type_id)
with the operand type if negation is validErr
with a descriptive error message if negation is invalid