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/Module.hs | |
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/Module.hs')
-rw-r--r-- | compiler/GHC/Tc/Module.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index 8f3cec19d0..174055bd01 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -2526,8 +2526,9 @@ tcRnExpr hsc_env mode rdr_expr -- Generalise uniq <- newUnique ; let { fresh_it = itName uniq (getLoc rdr_expr) } ; - (qtvs, dicts, _, residual, _) - <- simplifyInfer tclvl infer_mode + ((qtvs, dicts, _, _), residual) + <- captureConstraints $ + simplifyInfer tclvl infer_mode [] {- No sig vars -} [(fresh_it, res_ty)] lie ; |