Test scoping rules and prepare type checking