Documentation and minor fixes to type checks.

(E.g. ignoring ErrorType types as variable or method types in type
checks.)