Add test for transitive imports (currently fails)
Further elaborate imports during desugaring

This picks up module imports required for transitive instances that are
not known about during name desugaring
Handle `TypeInstanceDeclaration` properly

Stops `TypeInstanceDeclaration`s from being replaced with
`ExternInstanceDeclaration` during type checking
Don't disappear foreign declarations