Move non-logging code out of type_check_core into helpers
Summary:
The type_check_core function is currently a difficult-to-follow 234-line mixture of logging and procedural logic. Local variables are numerous and it is difficult to follow when they are read or rebound.
This change moves as much logic as possible out of type_check_core into helpers, leaving type_check_core to perform logging and to serve in its existing role as a scope for the local variable soup. These helpers make it much clearer which of these variables are read and written at each step, and reduces the cognitive overhead of reading the actual logic by reducing the number of locals in scope.
Reviewed By: arxanas, dabek
Differential Revision:
D10242675
fbshipit-source-id:
d0e7aaa043fcfe6be5b0b82c59a33564cc161d50