summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-12-17 16:53:02 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2020-12-28 10:30:16 +0000
commit4b0a264160f7c949e16c6973eb21bf396b34e0f6 (patch)
treec8dedc9952198bc11d32b08f9be3e5e678775d91 /compiler/GHC/Tc/Module.hs
parentcbc7c3dda6bdf4acb760ca9eb545faeb98ab0dbe (diff)
downloadhaskell-wip/T18929.tar.gz
Establish invariant (GivenInv)wip/T18929
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.hs5
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 ;