Circular dependency test and better errors