Add circular inheritance and reference checking for type checker.