Browse Source

type checker for Larray

Peter Thiemann 3 years ago
parent
commit
0a7d934fbb
1 changed files with 5 additions and 3 deletions
  1. 5 3
      book.tex

+ 5 - 3
book.tex

@@ -13113,10 +13113,12 @@ class TypeCheckLarray(TypeCheckLtup):
         self.check_type_equal(index_ty, IntType(), index)
         match tup_t:
           case ListType(ty):
-            self.check_type_equal(ty, value_t, ss[0])          
+            self.check_type_equal(ty, value_t, ss[0])
+          case TupleType(ts):
+            return self.type_check_stmts(ss, env)
           case _:
-            raise Exception('type_check_stmts: expected a list, not ' \
-                            + repr(tup_t))
+            raise Exception('type_check_stmts: '
+              'expected tuple or list, not ' + repr(tup_t))
         return self.type_check_stmts(ss[1:], env)
       case _:
         return super().type_check_stmts(ss, env)