diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2022-05-09 11:19:15 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2022-05-09 11:30:00 +0100 |
commit | 18f206614510fb31da9490496a268c1f8cb5c12e (patch) | |
tree | e50ab43c6fbe5be2d9388f14d2a9a4dc5b504f83 /compiler/GHC/Tc/Solver/Canonical.hs | |
parent | 67072c31d8b6ce4f0de79fa52bc3e5cdd5a495c6 (diff) | |
download | haskell-18f206614510fb31da9490496a268c1f8cb5c12e.tar.gz |
Fix Constraint vs Type againwip/21530
This patch fixes two bugs exposed in #21530. But it is
NOT the last word. See the discussion in #15918.
The basic plan is this:
* Fix `unifyWanted` in Canonical, by making the FunTy/FunTy
case check the AnonArgFlag. This is an easy win.
* Make `mkCastTy` use a version of `isReflexiveCo` that distinguishes
Constraint from Type. This isn't really "right"; but it's more
right than what we have.
Diffstat (limited to 'compiler/GHC/Tc/Solver/Canonical.hs')
-rw-r--r-- | compiler/GHC/Tc/Solver/Canonical.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Solver/Canonical.hs b/compiler/GHC/Tc/Solver/Canonical.hs index f63cb5c030..7b6af2b740 100644 --- a/compiler/GHC/Tc/Solver/Canonical.hs +++ b/compiler/GHC/Tc/Solver/Canonical.hs @@ -3081,7 +3081,9 @@ unifyWanted rewriters loc role orig_ty1 orig_ty2 go ty1 ty2 | Just ty1' <- tcView ty1 = go ty1' ty2 go ty1 ty2 | Just ty2' <- tcView ty2 = go ty1 ty2' - go (FunTy _ w1 s1 t1) (FunTy _ w2 s2 t2) + go (FunTy { ft_af = af1, ft_mult = w1, ft_arg = s1, ft_res = t1 }) + (FunTy { ft_af = af2, ft_mult = w2, ft_arg = s2, ft_res = t2 }) + | af1 == af2 -- Important! See #21530 = do { co_s <- unifyWanted rewriters loc role s1 s2 ; co_t <- unifyWanted rewriters loc role t1 t2 ; co_w <- unifyWanted rewriters loc Nominal w1 w2 |