Skip to content

Commit

Permalink
add assignment to has_type field in a couple places
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiek committed Nov 2, 2023
1 parent c37f6bc commit d01e2bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -14417,6 +14417,7 @@ \section{Challenge: Arrays}
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:
Expand Down Expand Up @@ -14456,6 +14457,7 @@ \section{Challenge: Arrays}
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)
Expand Down

0 comments on commit d01e2bc

Please sign in to comment.