From 74a5cf52a7fcf09552b259d4962c1eebe948ad21 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 23 Mar 2008 12:15:00 +0000 Subject: [PATCH] Stopped constants being assigned to in the type-checker for Rain --- frontends/RainTypes.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontends/RainTypes.hs b/frontends/RainTypes.hs index d590801..afc43b6 100644 --- a/frontends/RainTypes.hs +++ b/frontends/RainTypes.hs @@ -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