summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/FamInstEnv.hs
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/Core/FamInstEnv.hs
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/Core/FamInstEnv.hs')
-rw-r--r--compiler/GHC/Core/FamInstEnv.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Core/FamInstEnv.hs b/compiler/GHC/Core/FamInstEnv.hs
index 0876cacf57..3e0fc7361d 100644
--- a/compiler/GHC/Core/FamInstEnv.hs
+++ b/compiler/GHC/Core/FamInstEnv.hs
@@ -522,7 +522,7 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 })
(CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 })
= let (commonlhs1, commonlhs2) = zipAndUnzip lhs1 lhs2
-- See Note [Compatibility of eta-reduced axioms]
- in case tcUnifyTysFG (const BindMe) commonlhs1 commonlhs2 of
+ in case tcUnifyTysFG alwaysBindFun commonlhs1 commonlhs2 of
SurelyApart -> True
Unifiable subst
| Type.substTyAddInScope subst rhs1 `eqType`
@@ -1204,7 +1204,7 @@ apartnessCheck :: [Type]
-> Bool -- ^ True <=> equation can fire
apartnessCheck flattened_target (CoAxBranch { cab_incomps = incomps })
= all (isSurelyApart
- . tcUnifyTysFG (const BindMe) flattened_target
+ . tcUnifyTysFG alwaysBindFun flattened_target
. coAxBranchLHS) incomps
where
isSurelyApart SurelyApart = True