Fixes id-resolution for top-level inheritance.

An inherits statement at the top-level of a module now adds the
inherited identifiers to the current scope, as it should.  This
works with imported identifiers, provided the imports is described by
a .gct file.  Thus, it won't work with inheritance from "built-in"
modules, which at present have no .gct.

Note that this commit does not change code generation.  If a name
is not known to be inherited, the method that it refers to can still
be requested using self.

This commit adds a test for inheritance, and also some tests for
duplicate names, which should have been committed as part of b604a1e