summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-01-14 12:10:28 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-01-14 12:29:07 +0000
commit4b3a0c38209f35fe9cd757f8054769c6880fc4e6 (patch)
tree56bc55cedd53a085d3d63be3f393208218d1660e
parent2c6158a0abd8d7dd53c22477aa6740526aca79e4 (diff)
downloadhaskell-4b3a0c38209f35fe9cd757f8054769c6880fc4e6.tar.gz
update
-rw-r--r--compiler/GHC/Core/InstEnv.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/Core/InstEnv.hs b/compiler/GHC/Core/InstEnv.hs
index 210907e150..5e98bac541 100644
--- a/compiler/GHC/Core/InstEnv.hs
+++ b/compiler/GHC/Core/InstEnv.hs
@@ -870,11 +870,11 @@ lookupInstEnv' :: InstEnv -- InstEnv to look in
-- giving a suitable error message
lookupInstEnv' (InstEnv rm) vis_mods cls tys
- = pprTrace "lookupInstEnv'" (ppr cls <+> ppr (length rough_matches) <+> ppr tys <+> ppr rough_tcs)
+ = -- pprTrace "lookupInstEnv'" (ppr cls <+> ppr (length rough_matches) <+> ppr tys <+> ppr rough_tcs <+> ppr (moduleSetElts vis_mods) $$ ppr r1 $$ ppr r2) (r1, r2)
+ (r1, r2)
- -- pprTraceIt "lookupInstEnv'"
- (foldr check_match [] rough_matches, check_unifier NoUnifiers (bagToList rough_unifiers))
where
+ (r1, r2) = (foldr check_match [] rough_matches, check_unifier NoUnifiers (bagToList rough_unifiers))
(rough_matches, rough_unifiers) = lookupRM' rough_tcs rm
rough_tcs = LookupKnownTc (className cls) : roughMatchTcsLookup tys
@@ -896,6 +896,8 @@ lookupInstEnv' (InstEnv rm) vis_mods cls tys
check_unifier :: PotentialUnifiers -> [ClsInst] -> PotentialUnifiers
check_unifier acc [] = acc
check_unifier acc (item@ClsInst { is_tvs = tpl_tvs, is_tys = tpl_tys }:items)
+ | not (instIsVisible vis_mods item)
+ = check_unifier acc items -- See Note [Instance lookup and orphan instances]
| [_] <- check_match item [] = check_unifier acc items
-- Does not match, so next check whether the things unify
-- See Note [Overlapping instances]