diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-12-17 16:53:02 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-02 07:34:01 -0500 |
commit | 5650c79e0087fb37311fbe81a2ce6f63b36b91d3 (patch) | |
tree | 6bdc3d6cf1f815a778b539228ac21cb6c4bf66e1 /compiler/GHC/Tc/TyCl | |
parent | 87bc458de497cdc407c5c32572103a452ee36e4d (diff) | |
download | haskell-5650c79e0087fb37311fbe81a2ce6f63b36b91d3.tar.gz |
Establish invariant (GivenInv)
This patch establishes invariant (GivenInv) from GHC.Tc.Utils.TcType
Note [TcLevel invariants]. (GivenInv) says that unification variables
from level 'n' should not appear in the Givens for level 'n'. See
Note [GivenInv] in teh same module.
This invariant was already very nearly true, but a dark corner of
partial type signatures made it false. The patch re-jigs partial type
signatures a bit to avoid the problem, and documents the invariant
much more thorughly
Fixes #18646 along the way: see Note [Extra-constraints wildcards]
in GHC.Tc.Gen.Bind
I also simplified the interface to tcSimplifyInfer slightly, so that
it /emits/ the residual constraint, rather than /returning/ it.
Diffstat (limited to 'compiler/GHC/Tc/TyCl')
-rw-r--r-- | compiler/GHC/Tc/TyCl/PatSyn.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/TyCl/PatSyn.hs b/compiler/GHC/Tc/TyCl/PatSyn.hs index 0a0b3f3bad..880787447e 100644 --- a/compiler/GHC/Tc/TyCl/PatSyn.hs +++ b/compiler/GHC/Tc/TyCl/PatSyn.hs @@ -166,8 +166,9 @@ tcInferPatSynDecl (PSB { psb_id = lname@(L _ name), psb_args = details -- ex_tvs in its kind k. -- See Note [Type variables whose kind is captured] - ; (univ_tvs, req_dicts, ev_binds, residual, _) - <- simplifyInfer tclvl NoRestrictions [] named_taus wanted + ; ((univ_tvs, req_dicts, ev_binds, _), residual) + <- captureConstraints $ + simplifyInfer tclvl NoRestrictions [] named_taus wanted ; top_ev_binds <- checkNoErrs (simplifyTop residual) ; addTopEvBinds top_ev_binds $ |