- LocalDef -> [rdr_name]
- Imported is -> map mk_qual_rdr is
- mk_qual_rdr imp_spec = mkRdrQual (is_as (is_decl imp_spec)) rdr_occ
- rdr_occ = rdrNameOcc rdr_name
+ LocalDef -> rdr_name
+ Imported is -> used_rdr_name_from_is is
+
+ used_rdr_name_from_is imp_specs -- rdr_name is unqualified
+ | not (all (is_qual . is_decl) imp_specs)
+ = rdr_name -- An unqualified import is available
+ | otherwise
+ = -- Only qualified imports available, so make up
+ -- a suitable qualifed name from the first imp_spec
+ ASSERT( not (null imp_specs) )
+ mkRdrQual (is_as (is_decl (head imp_specs))) rdr_occ