Update Rain typechecker to match isIntegerType change.

isIntegerType now recognises Time as an integral type, so the rules for Time
operations in the Rain typechecker needed updating.
This commit is contained in:
Adam Sampson 2008-03-26 14:55:15 +00:00
parent 2655b9b049
commit b296706bea

View File

@ -271,11 +271,11 @@ checkExpressionTypes = applyDepthM checkExpression
else A.Conversion (findMeta e) A.DefaultConversion dest e
validOpSameType :: A.DyadicOp -> A.Type -> Bool
validOpSameType A.Plus t = (isIntegerType t) || (t == A.Time)
validOpSameType A.Minus t = (isIntegerType t) || (t == A.Time)
validOpSameType A.Times t = isIntegerType t
validOpSameType A.Div t = isIntegerType t
validOpSameType A.Rem t = isIntegerType t
validOpSameType A.Plus t = isIntegerType t
validOpSameType A.Minus t = isIntegerType t
validOpSameType A.Times t = isIntegerType t && t /= A.Time
validOpSameType A.Div t = isIntegerType t && t /= A.Time
validOpSameType A.Rem t = isIntegerType t && t /= A.Time
validOpSameType A.Eq _ = True
validOpSameType A.NotEq _ = True
validOpSameType A.Less t = haveOrder t