summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcDeriv.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-02-21 13:29:16 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-02-21 14:26:57 +0000
commit713ebd7cf03876c6bedc1be9fba8f60ccc5bc8f0 (patch)
tree8aa42a785d1ea8ee84b69ca091c09ac4ef8d6aba /compiler/typecheck/TcDeriv.hs
parentfd841f877ab7a991f667a50b401404927f6f599c (diff)
downloadhaskell-713ebd7cf03876c6bedc1be9fba8f60ccc5bc8f0.tar.gz
Fix computation of dfun_tvs in mkNewTypeEqn
This bug was causing Trac #13297. We were recomputing ds_tvs, and doing it wrongly (by omitting variables that appear only in mtheta). But actually plain 'tvs' is just fine. So code deleted, and bug fixed.
Diffstat (limited to 'compiler/typecheck/TcDeriv.hs')
-rw-r--r--compiler/typecheck/TcDeriv.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 00869c4f4b..55b7d6d64f 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -1177,7 +1177,7 @@ mkNewTypeEqn dflags overlap_mode tvs
case mtheta of
Just theta -> return $ GivenTheta $ DS
{ ds_loc = loc
- , ds_name = dfun_name, ds_tvs = dfun_tvs
+ , ds_name = dfun_name, ds_tvs = tvs
, ds_cls = cls, ds_tys = inst_tys
, ds_tc = rep_tycon
, ds_theta = theta
@@ -1185,7 +1185,7 @@ mkNewTypeEqn dflags overlap_mode tvs
, ds_mechanism = mechanism }
Nothing -> return $ InferTheta $ DS
{ ds_loc = loc
- , ds_name = dfun_name, ds_tvs = dfun_tvs
+ , ds_name = dfun_name, ds_tvs = tvs
, ds_cls = cls, ds_tys = inst_tys
, ds_tc = rep_tycon
, ds_theta = all_thetas
@@ -1258,7 +1258,6 @@ mkNewTypeEqn dflags overlap_mode tvs
-- See Note [Newtype deriving superclasses] above
sc_preds :: [PredOrigin]
cls_tyvars = classTyVars cls
- dfun_tvs = tyCoVarsOfTypesWellScoped inst_tys
inst_ty = mkTyConApp tycon tc_args
inst_tys = cls_tys ++ [inst_ty]
sc_preds = map (mkPredOrigin DerivOrigin TypeLevel) $
@@ -1278,7 +1277,7 @@ mkNewTypeEqn dflags overlap_mode tvs
= [ mkPredOrigin (DerivOriginCoerce meth t1 t2) TypeLevel
(mkReprPrimEqPred t1 t2)
| meth <- meths
- , let (Pair t1 t2) = mkCoerceClassMethEqn cls dfun_tvs
+ , let (Pair t1 t2) = mkCoerceClassMethEqn cls tvs
inst_tys rep_inst_ty meth ]
all_thetas :: [ThetaOrigin]