pub fn check_relational_operation(
context: &CompilationContext,
left_type: &TypeId,
right_type: &TypeId,
operator: &BinaryOperator,
location: &Location,
) -> SemanticResult
Expand description
Checks if types are compatible for relational operations (>, <, >=, <=, ==, !=). Types must be comparable with each other, which means they’re either:
- Exactly the same type (except Unit)
- Unspecified integer literal and an integer type
- Unspecified float literal and a float type
§Arguments
context
- The compilation contextleft_type
- The type of the left operandright_type
- The type of the right operandoperator
- The relational operatorlocation
- The source location of the operation
§Returns
Ok(bool_type())
if the types are comparableErr
with a descriptive error message otherwise