Function check_logical_operation

Source
pub fn check_logical_operation(
    left_type: &TypeId,
    right_type: &TypeId,
    operator: &BinaryOperator,
    location: &Location,
) -> SemanticResult
Expand description

Checks if types are compatible for logical operations (AND, OR). Both operands must be boolean types.

§Arguments

  • left_type - The type of the left operand
  • right_type - The type of the right operand
  • operator - The logical operator (either And or Or)
  • location - The source location of the operation

§Returns

  • Ok(bool_type()) if both operands are boolean
  • Err with a descriptive error message otherwise