summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Instance
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@richarde.dev>2021-01-05 22:40:53 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-23 15:29:58 -0500
commit8fd855f09db0090df74a2e35eace7da973f62c86 (patch)
treed40af8ffa28d1b05411869aa1a972091d3eca07c /compiler/GHC/Tc/Instance
parent420ef55a0d28a177fab981655a1c44291b441382 (diff)
downloadhaskell-8fd855f09db0090df74a2e35eace7da973f62c86.tar.gz
Make matchableGivens more reliably correct.
This has two fixes: 1. Take TyVarTvs into account in matchableGivens. This fixes #19106. 2. Don't allow unifying alpha ~ Maybe alpha. This fixes #19107. This patch also removes a redundant Note and redirects references to a better replacement. Also some refactoring/improvements around the BindFun in the pure unifier, which now can take the RHS type into account. Close #19106. Close #19107. Test case: partial-sigs/should_compile/T19106, typecheck/should_compile/T19107
Diffstat (limited to 'compiler/GHC/Tc/Instance')
-rw-r--r--compiler/GHC/Tc/Instance/FunDeps.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/GHC/Tc/Instance/FunDeps.hs b/compiler/GHC/Tc/Instance/FunDeps.hs
index c89a13dae8..3abb0140b1 100644
--- a/compiler/GHC/Tc/Instance/FunDeps.hs
+++ b/compiler/GHC/Tc/Instance/FunDeps.hs
@@ -656,9 +656,7 @@ checkFunDeps inst_envs (ClsInst { is_tvs = qtvs1, is_cls = cls
(ltys1, rtys1) = instFD fd cls_tvs tys1
(ltys2, rtys2) = instFD fd cls_tvs tys2
qtv_set2 = mkVarSet qtvs2
- bind_fn tv | tv `elemVarSet` qtv_set1 = BindMe
- | tv `elemVarSet` qtv_set2 = BindMe
- | otherwise = Skolem
+ bind_fn = matchBindFun (qtv_set1 `unionVarSet` qtv_set2)
eq_inst i1 i2 = instanceDFunId i1 == instanceDFunId i2
-- A single instance may appear twice in the un-nubbed conflict list