handle refs to circular type aliases
much better error messages
#596