Function check_unary_operation

Source
pub fn check_unary_operation(
    context: &CompilationContext,
    unary_expr: &UnaryExpr,
    operand_type: &TypeId,
) -> SemanticResult
Expand description

Checks if a unary operation is valid for the given operand type. Handles both arithmetic negation (-) and logical negation (!).

§Arguments

  • context - The compilation context
  • unary_expr - The unary expression to check
  • operand_type - The type of the operand

§Returns

  • Ok(type_id) with the resulting type if the operation is valid
  • Err with a descriptive error message if the operation is invalid