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 contextunary_expr
- The unary expression to checkoperand_type
- The type of the operand
§Returns
Ok(type_id)
with the resulting type if the operation is validErr
with a descriptive error message if the operation is invalid