Just have a little pass that runs right after type checking that goes through the whole program and makes sure that:
Not strictly necessary, but I bet it'll catch bugs before the unit tests do.
Implemented in 17a8df4a7daf and indeed it catches many bugs! Whoops!
Bugfixes and updated tests in commit 75f6073fde1a . Followup in #28.