Make changes to report error if the type used from external module cannot be named

Adds test cases too