- | tc_mod == this_mod = ptext SLIT("this module")
- | otherwise = ptext SLIT("module") <+> quotes (ppr tc_mod) <+> mk_pkg this_mod
- mk_pkg this_mod
- | tc_pkg == modulePackageId this_mod = empty
- | otherwise = ptext SLIT("from package") <+> quotes (ppr tc_pkg)
+ | tc_mod == this_mod = ptext SLIT("in this module")
+
+ | not home_pkg && tc2_pkg /= tc_pkg = pp_pkg
+ -- Suppress the module name if (a) it's from another package
+ -- (b) other_ty isn't from that same package
+
+ | otherwise = ptext SLIT("in module") <+> quotes (ppr tc_mod) <+> pp_pkg
+ where
+ home_pkg = tc_pkg == modulePackageId this_mod
+ pp_pkg | home_pkg = empty
+ | otherwise = ptext SLIT("in package") <+> quotes (ppr tc_pkg)