\begin{code}
unQualInScope :: GlobalRdrEnv -> Name -> Bool
+-- True if 'f' is in scope, and has only one binding
+-- (i.e. false if A.f and B.f are both in scope as unqualified 'f')
unQualInScope env
= (`elemNameSet` unqual_names)
where
(_, dups) = removeDups compare all_names
in
-- Check for duplicate definitions
+ -- The complaint will come out as "Multiple declarations of Foo.f" because
+ -- since 'f' is in the env twice, the unQualInScope used by the error-msg
+ -- printer returns False. It seems awkward to fix, unfortunately.
mapRn_ (addErrRn . dupDeclErr) dups `thenRn_`