Stopped constants being assigned to in the type-checker for Rain

This commit is contained in:
Neil Brown 2008-03-23 12:15:00 +00:00
parent b316a7d3f4
commit 74a5cf52a7

View File

@ -307,6 +307,9 @@ checkAssignmentTypes = applyDepthM checkAssignment
checkAssignment ass@(A.Assign m [v] (A.ExpressionList m' [e]))
= do trhs <- typeOfExpression e
tlhs <- typeOfVariable v
am <- abbrevModeOfVariable v
when (am == A.ValAbbrev) $
diePC m $ formatCode "Cannot assign to a constant variable: %" v
if (tlhs == trhs)
then return ass
else do rhs' <- coerceType " in assignment" tlhs trhs e