@@ -378,12 +378,18 @@ predicateRestrictionFilter context _ (RelationalExprPredicate relExpr) = case ru
379 Left $ PredicateExpressionError "Relational restriction filter must evaluate to 'true' or 'false'"
379 Left $ PredicateExpressionError "Relational restriction filter must evaluate to 'true' or 'false'"
381−predicateRestrictionFilter context _ (AttributeEqualityPredicate attrName atomexpr) = Right $ \tupleIn -> case atomForAttributeName attrName tupleIn of
381+predicateRestrictionFilter context attrs (AttributeEqualityPredicate attrName atomExpr) = do
382− Left _ -> False
382+ attr <- A.attributeForName attrName attrs
383− Right atomIn ->
383+ atomExprType <- typeFromAtomExpr attrs context atomExpr
384− case evalAtomExpr tupleIn context atomexpr of
384+ if atomExprType /= A.atomType attr then
385+ Left $ TupleAttributeTypeMismatchError (A.attributesFromList [attr])
387+ Right $ \tupleIn -> case atomForAttributeName attrName tupleIn of
385 Left _ -> False
388 Left _ -> False
390+ case evalAtomExpr tupleIn context atomExpr of
386− Right atomCmp -> atomCmp == atomIn
392+ Right atomCmp -> atomCmp == atomIn
388-- in the future, it would be useful to do typechecking on the attribute and atom expr filters in advance
394-- in the future, it would be useful to do typechecking on the attribute and atom expr filters in advance
389predicateRestrictionFilter context attrs (AtomExprPredicate atomExpr) = do
395predicateRestrictionFilter context attrs (AtomExprPredicate atomExpr) = do