Closed AndrewTolmach closed 1 year ago
Thanks!
It looks like the type checking code in the book got out-of-date. I've updated type_check_stmts
to return VoidType
when ss
is empty. Also, the text was completely missing a description of how to type check function definitions. I've added a description.
Ch. 8 doesn't say what happens if a function "falls off the end" and, more generally, doesn't indicate whether it is possible to write
return None
or justreturn
. Experimenting with the implementation suggests thatreturn None
is intended to be valid, and that falling off the end has the same effect, but barereturn
is not allowed. (The implementation was not entirely working, however -- see related PRs). In any case, the book should say just a few words about this.