diff python/c3/typecheck.py @ 164:e023d3ce1d63

Fix to loc of assignment
author Windel Bouwman
date Mon, 18 Mar 2013 22:15:57 +0100
parents 8104fc8b5e90
children 598d3888a11c
line wrap: on
line diff
--- a/python/c3/typecheck.py	Mon Mar 18 20:13:57 2013 +0100
+++ b/python/c3/typecheck.py	Mon Mar 18 22:15:57 2013 +0100
@@ -25,7 +25,8 @@
          if not equalTypes(sym.condition.typ, boolType):
             self.diag.error('Condition must be a boolean expression', sym.condition.loc)
       elif type(sym) is Assignment:
-         pass
+         if not equalTypes(sym.lval.typ, sym.rval.typ):
+            self.diag.error('Cannot assign {0} to {1}'.format(sym.rval.typ, sym.lval.typ), sym.loc)
       elif type(sym) is ReturnStatement:
          pass
       elif type(sym) is ProcedureCall: