|
@@ -26,7 +26,7 @@
|
|
|
|
|
|
\def\racketEd{0}
|
|
|
\def\pythonEd{1}
|
|
|
-\def\edition{0}
|
|
|
+\def\edition{1}
|
|
|
|
|
|
% material that is specific to the Racket edition of the book
|
|
|
\newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
|
|
@@ -14417,6 +14417,7 @@ class TypeCheckLarray(TypeCheckLtup):
|
|
|
raise Exception('len expected a tuple, not ' + repr(tup_t))
|
|
|
case Subscript(tup, index, Load()):
|
|
|
tup_ty = self.type_check_exp(tup, env)
|
|
|
+ tup.has_type = tup_ty
|
|
|
index_ty = self.type_check_exp(index, env)
|
|
|
self.check_type_equal(index_ty, IntType(), index)
|
|
|
match tup_ty:
|
|
@@ -14456,6 +14457,7 @@ class TypeCheckLarray(TypeCheckLtup):
|
|
|
match ss[0]:
|
|
|
case Assign([Subscript(tup, index, Store())], value):
|
|
|
tup_t = self.type_check_exp(tup, env)
|
|
|
+ tup.has_type = tup_t
|
|
|
value_t = self.type_check_exp(value, env)
|
|
|
index_ty = self.type_check_exp(index, env)
|
|
|
self.check_type_equal(index_ty, IntType(), index)
|