Stopped constants being assigned to in the type-checker for Rain
This commit is contained in:
parent
b316a7d3f4
commit
74a5cf52a7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user