fix: make int binary operators and char binary operators errors consistent
This commit is contained in:
parent
8a7b37e05f
commit
4d25d7a730
@ -246,18 +246,17 @@ object typeChecker {
|
||||
)
|
||||
KnownType.Bool.satisfies(constraint, op.pos)
|
||||
case op: (Less | LessEq | Greater | GreaterEq) =>
|
||||
val xTy = checkValue(
|
||||
op.x,
|
||||
Constraint.IsEither(
|
||||
val xConstraint = Constraint.IsEither(
|
||||
KnownType.Int,
|
||||
KnownType.Char,
|
||||
s"${op.name} operator must be applied to an int or char"
|
||||
)
|
||||
)
|
||||
checkValue(
|
||||
op.y,
|
||||
val yConstraint = checkValue(op.x, xConstraint) match {
|
||||
case ? => xConstraint
|
||||
case xTy =>
|
||||
Constraint.Is(xTy, s"${op.name} operator must be applied to values of the same type")
|
||||
)
|
||||
}
|
||||
checkValue(op.y, yConstraint)
|
||||
KnownType.Bool.satisfies(constraint, op.pos)
|
||||
case op: (And | Or) =>
|
||||
val operand = Constraint.Is(KnownType.Bool, s"${op.name} operator must be applied to a bool")
|
||||
|
Loading…
x
Reference in New Issue
Block a user