diff options
| author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-12-02 11:21:10 +0000 |
|---|---|---|
| committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-12-30 16:27:22 +0000 |
| commit | d6bdb903ac8e85a92e12950019e4aef940defaad (patch) | |
| tree | df30124f09b1b72b86c4c901b1a0d384d1a76cdc | |
| parent | 56609bd8f3c2d2abb6ee453646b71170c512268d (diff) | |
| download | haskell-d6bdb903ac8e85a92e12950019e4aef940defaad.tar.gz | |
Updates
| -rw-r--r-- | compiler/GHC/Core/TyCo/Tidy.hs | 4 | ||||
| -rw-r--r-- | compiler/GHC/Tc/Errors.hs | 27 | ||||
| -rw-r--r-- | compiler/GHC/Tc/Gen/HsType.hs | 2 | ||||
| -rw-r--r-- | compiler/GHC/Tc/TyCl.hs | 18 | ||||
| -rw-r--r-- | testsuite/driver/testlib.py | 2 |
5 files changed, 32 insertions, 21 deletions
diff --git a/compiler/GHC/Core/TyCo/Tidy.hs b/compiler/GHC/Core/TyCo/Tidy.hs index d9ce6d1043..9c8e90abe3 100644 --- a/compiler/GHC/Core/TyCo/Tidy.hs +++ b/compiler/GHC/Core/TyCo/Tidy.hs @@ -118,8 +118,8 @@ tidyOpenTyCoVar env@(_, subst) tyvar tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar tidyTyCoVarOcc env@(_, subst) tv = case lookupVarEnv subst tv of - Nothing -> - updateTcTyVarSkolemInfo (tidySkolemInfo env) $ updateVarType (tidyType env) tv + Nothing -> updateVarType (tidyType env) tv +-- updateTcTyVarSkolemInfo (tidySkolemInfo env) $ Just tv' -> tv' --------------- diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs index af3d2aa710..8d5433efa3 100644 --- a/compiler/GHC/Tc/Errors.hs +++ b/compiler/GHC/Tc/Errors.hs @@ -1299,7 +1299,9 @@ mkHoleError lcl_name_cache tidy_simples ctxt hole@(Hole { hole_occ = occ then validHoleFits ctxt tidy_simples hole else return (ctxt, empty) - ; let err = important hole_msg `mappend` + + ; zonked_skol_tvs <- mapM zonkTyVarSkolemInfo skol_tvs + ; let err = important (hole_msg zonked_skol_tvs) `mappend` mk_relevant_bindings (binds_msg $$ constraints_msg) `mappend` valid_hole_fits sub_msg @@ -1315,16 +1317,16 @@ mkHoleError lcl_name_cache tidy_simples ctxt hole@(Hole { hole_occ = occ hole_kind = tcTypeKind hole_ty tyvars = tyCoVarsOfTypeList hole_ty - hole_msg = case sort of + hole_msg zonked_skol_tvs = case sort of ExprHole _ -> vcat [ hang (text "Found hole:") 2 (pp_occ_with_type occ hole_ty) - , tyvars_msg, expr_hole_hint ] + , tyvars_msg zonked_skol_tvs, expr_hole_hint ] TypeHole -> vcat [ hang (text "Found type wildcard" <+> quotes (ppr occ)) 2 (text "standing for" <+> quotes pp_hole_type_with_kind) - , tyvars_msg, type_hole_hint ] + , tyvars_msg zonked_skol_tvs, type_hole_hint ] ConstraintHole -> vcat [ hang (text "Found extra-constraints wildcard standing for") 2 (quotes $ pprType hole_ty) -- always kind constraint - , tyvars_msg, type_hole_hint ] + , tyvars_msg zonked_skol_tvs, type_hole_hint ] pp_hole_type_with_kind | isLiftedTypeKind hole_kind @@ -1334,12 +1336,13 @@ mkHoleError lcl_name_cache tidy_simples ctxt hole@(Hole { hole_occ = occ | otherwise = pprType hole_ty <+> dcolon <+> pprKind hole_kind - tyvars_msg = ppUnless (null tyvars) $ + is_skol tv = isTcTyVar tv && isSkolemTyVar tv + (skol_tvs, other_tvs) = partition is_skol tyvars + + tyvars_msg zonked_skol_tvs = ppUnless (null tyvars) $ text "Where:" <+> (vcat (map loc_msg other_tvs) - $$ pprSkols ctxt skol_tvs) + $$ pprSkols ctxt zonked_skol_tvs) where - (skol_tvs, other_tvs) = partition is_skol tyvars - is_skol tv = isTcTyVar tv && isSkolemTyVar tv -- Coercion variables can be free in the -- hole, via kind casts @@ -1647,7 +1650,11 @@ mkTyVarEqErr :: ReportErrCtxt -> Report -> Ct mkTyVarEqErr ctxt report ct tv1 ty2 = do { traceTc "mkTyVarEqErr" (ppr ct $$ ppr tv1 $$ ppr ty2) ; dflags <- getDynFlags - ; return $ mkTyVarEqErr' dflags ctxt report ct tv1 ty2 } + ; zonked_skol_tv <- zonkTyVarSkolemInfo tv1 + ; zonked_ty2 <- case tcGetCastedTyVar_maybe ty2 of + Just (tv, co) -> flip mkCastTy co . mkTyVarTy <$> zonkTyVarSkolemInfo tv + Nothing -> pure ty2 + ; return $ mkTyVarEqErr' dflags ctxt report ct zonked_skol_tv zonked_ty2 } mkTyVarEqErr' :: DynFlags -> ReportErrCtxt -> Report -> Ct -> TcTyVar -> TcType -> Report diff --git a/compiler/GHC/Tc/Gen/HsType.hs b/compiler/GHC/Tc/Gen/HsType.hs index 320db57cbc..6590b017d6 100644 --- a/compiler/GHC/Tc/Gen/HsType.hs +++ b/compiler/GHC/Tc/Gen/HsType.hs @@ -4181,7 +4181,7 @@ tcHsPatSigType ctxt hole_mode new_implicit_tv name = do { kind <- newMetaKindVar ; tv <- case ctxt of - RuleSigCtxt {} -> newSkolemTyVar unkSkol name kind + RuleSigCtxt rname _ -> newSkolemTyVar (RuleSkol rname) name kind _ -> newPatSigTyVar name kind -- See Note [Typechecking pattern signature binders] -- NB: tv's Name may be fresh (in the case of newPatSigTyVar) diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs index b61d83e21a..c232aa55f5 100644 --- a/compiler/GHC/Tc/TyCl.hs +++ b/compiler/GHC/Tc/TyCl.hs @@ -1579,7 +1579,9 @@ kcTyClDecl :: TyClDecl GhcRn -> TcTyCon -> TcM () kcTyClDecl (DataDecl { tcdLName = (L _ name), tcdDataDefn = defn }) tycon | HsDataDefn { dd_ctxt = ctxt, dd_cons = cons, dd_ND = new_or_data } <- defn - = bindTyClTyVars (TyConSkol callStack DataTypeFlavour name) name $ \ _ _ _ -> + = --bindTyClTyVars (TyConSkol callStack DataTypeFlavour name) name $ \ _ binders _ -> + + tcExtendNameTyVarEnv (tcTyConScopedTyVars tycon) $ -- NB: binding these tyvars isn't necessary for GADTs, but it does no -- harm. For GADTs, each data con brings its own tyvars into scope, -- and the ones from this bindTyClTyVars are either not mentioned or @@ -1589,15 +1591,16 @@ kcTyClDecl (DataDecl { tcdLName = (L _ name), tcdDataDefn = defn }) tycon ; kcConDecls new_or_data (tyConResKind tycon) cons } -kcTyClDecl (SynDecl { tcdLName = L _ name, tcdRhs = rhs }) _tycon - = bindTyClTyVars (TyConSkol callStack TypeSynonymFlavour name) name $ \ _ _ res_kind -> - discardResult $ tcCheckLHsType rhs (TheKind res_kind) +kcTyClDecl (SynDecl { tcdLName = L _ name, tcdRhs = rhs }) tycon + = tcExtendNameTyVarEnv (tcTyConScopedTyVars tycon) $ + let res_kind = tyConResKind tycon + in discardResult $ tcCheckLHsType rhs (TheKind res_kind) -- NB: check against the result kind that we allocated -- in inferInitialKinds. kcTyClDecl (ClassDecl { tcdLName = L _ name - , tcdCtxt = ctxt, tcdSigs = sigs }) _tycon - = bindTyClTyVars (TyConSkol callStack ClassFlavour name) name $ \ _ _ _ -> + , tcdCtxt = ctxt, tcdSigs = sigs }) tycon + = tcExtendNameTyVarEnv (tcTyConScopedTyVars tycon) $ do { _ <- tcHsContext ctxt ; mapM_ (wrapLocMA_ kc_sig) sigs } where @@ -3149,7 +3152,8 @@ tcTyFamInstEqnGuts fam_tc mb_clsinfo outer_hs_bndrs hs_pats hs_rhs_ty -- See Note [Generalising in tcTyFamInstEqnGuts] ; dvs <- candidateQTyVarsOfTypes (lhs_ty : mkTyVarTys outer_tvs) - ; qtvs <- quantifyTyVars unkSkol TryNotToDefaultNonStandardTyVars dvs + -- MP: @rae these qtvs end up in a no skolem info message for T14904a + ; qtvs <- quantifyTyVars FamInstSkol TryNotToDefaultNonStandardTyVars dvs ; reportUnsolvedEqualities FamInstSkol qtvs tclvl wanted ; checkFamTelescope tclvl outer_hs_bndrs outer_tvs diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index cc25f2aa8b..fb2a7010f5 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -2249,7 +2249,7 @@ def normalise_callstacks(s: str) -> str: location = normalise_slashes_(location) return ', called at {0}:<line>:<column> in <package-id>:'.format(location) # Ignore line number differences in call stacks (#10834). - #s = re.sub(callSite_re, repl, s) + s = re.sub(callSite_re, repl, s) # Ignore the change in how we identify implicit call-stacks s = s.replace('from ImplicitParams', 'from HasCallStack') if not opts.keep_prof_callstacks: |
