diff options
| author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-01-04 00:33:53 +0000 |
|---|---|---|
| committer | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-01-04 00:33:53 +0000 |
| commit | c1836dc9e450f3286fc25b4fe63030e0c11687b7 (patch) | |
| tree | 74c39a041286a3c0092767a2f09a3a1d4446439d | |
| parent | 232e11b96fea59409ff112899d1f9fa0871ff195 (diff) | |
| download | haskell-c1836dc9e450f3286fc25b4fe63030e0c11687b7.tar.gz | |
Nasty wibble in Errors.hs
| -rw-r--r-- | compiler/GHC/Tc/Errors.hs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs index b68bab17ff..3926c7dd85 100644 --- a/compiler/GHC/Tc/Errors.hs +++ b/compiler/GHC/Tc/Errors.hs @@ -49,6 +49,7 @@ import GHC.Types.Name.Set import GHC.Types.SrcLoc import GHC.Types.Basic import GHC.Types.Error +import GHC.Types.Unique ( getUnique ) import GHC.Types.Unique.Set ( nonDetEltsUniqSet ) import qualified GHC.Types.Unique.Map as UM @@ -446,7 +447,7 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs where tcl_env = ic_env implic insoluble = isInsolubleStatus status - (env1, tvs') = mapAccumL tidyVarBndr (cec_tidy ctxt) $ + (env1, tvs') = mapAccumL tidy_skol (cec_tidy ctxt) $ scopedSort tvs -- scopedSort: the ic_skols may not be in dependency order -- (see Note [Skolems in an implication] in GHC.Tc.Types.Constraint) @@ -477,6 +478,20 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs IC_BadTelescope -> True _ -> False + -- The ic_skols can be TyVars, not TcTyVars. But if we tidy them, + -- and then replace their /occurrences/ with the tidied TyVars, they + -- won't have any SkolemInfo in them. So we tidy them to skolem TcTyVars + -- Very ugly, but works fine. + tidy_skol :: TidyEnv -> TcTyVar -> (TidyEnv, TcTyVar) + tidy_skol env tv = tidyVarBndr env tc_tv + where + tc_tv | isTcTyVar tv = tv + | otherwise = mkTcTyVar (tyVarName tv) (tyVarKind tv) skol_details + + skol_details :: TcTyVarDetails + skol_details = SkolemTv (SkolemInfo (getUnique evb) info) tc_lvl False + -- False is pretty dubious, but it'll do for now + warnRedundantConstraints :: ReportErrCtxt -> TcLclEnv -> SkolemInfoAnon -> [EvVar] -> TcM () -- See Note [Tracking redundant constraints] in GHC.Tc.Solver warnRedundantConstraints ctxt env info ev_vars |
