code: func (c *Compiler) checkTypes() {
  	// Recursion is caught in earlier step, so this cannot fail.
  	sorted, _ := c.Graph.Sort()
  	checker := newTypeChecker()
  	env, errs := checker.CheckTypes(c.TypeEnv, sorted)
  	for _, err := range errs {
  		c.err(err)
  	}
  	c.TypeEnv = env
  }
docs: // checkTypes runs the type checker on all rules. The type checker builds a
  // TypeEnv that is stored on the compiler.