diff options
-rw-r--r-- | compiler/GHC/Core.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Lint.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Rules.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Driver/Types.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Hs/Decls.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/HsToCore.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Rename/HsType.hs | 86 | ||||
-rw-r--r-- | compiler/GHC/Rename/Module.hs | 33 | ||||
-rw-r--r-- | compiler/GHC/Rename/Utils.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Tc/Gen/Rule.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/dependent/should_fail/T16326_Fail10.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/T5331.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/ghci/p14.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T10072.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T5853.stderr | 2 |
17 files changed, 96 insertions, 63 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs index 3730e8e919..b4e149af7e 100644 --- a/compiler/GHC/Core.hs +++ b/compiler/GHC/Core.hs @@ -1291,7 +1291,7 @@ Orphan-hood is computed {- ************************************************************************ * * -\subsection{Transformation rules} +\subsection{Rewrite rules} * * ************************************************************************ diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs index fbe7d0007f..6648041805 100644 --- a/compiler/GHC/Core/Lint.hs +++ b/compiler/GHC/Core/Lint.hs @@ -467,7 +467,7 @@ lintCoreBindings dflags pass local_in_scope binds where all_pairs = flattenBinds binds -- Put all the top-level binders in scope at the start - -- This is because transformation rules can bring something + -- This is because rewrite rules can bring something -- into use 'unexpectedly'; see Note [Glomming] in OccurAnal binders = map fst all_pairs diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs index af7a3a405d..2e748beb28 100644 --- a/compiler/GHC/Core/Opt/Simplify.hs +++ b/compiler/GHC/Core/Opt/Simplify.hs @@ -170,7 +170,7 @@ simplTopBinds :: SimplEnv -> [InBind] -> SimplM (SimplFloats, SimplEnv) -- See Note [The big picture] simplTopBinds env0 binds0 = do { -- Put all the top-level binders into scope at the start - -- so that if a transformation rule has unexpectedly brought + -- so that if a rewrite rule has unexpectedly brought -- anything into scope, then we don't get a complaint about that. -- It's rather as if the top-level binders were imported. -- See note [Glomming] in OccurAnal. diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs index abf9614cb6..80566c2851 100644 --- a/compiler/GHC/Core/Rules.hs +++ b/compiler/GHC/Core/Rules.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[CoreRules]{Transformation rules} +\section[CoreRules]{Rewrite rules} -} {-# LANGUAGE CPP #-} diff --git a/compiler/GHC/Driver/Types.hs b/compiler/GHC/Driver/Types.hs index 6903b3608f..171dce0f3b 100644 --- a/compiler/GHC/Driver/Types.hs +++ b/compiler/GHC/Driver/Types.hs @@ -2488,7 +2488,7 @@ lookupFixity env n = case lookupNameEnv env n of -- * An instance declaration in a module other than the definition -- module for one of the type constructors or classes in the instance head -- --- * A transformation rule in a module other than the one defining +-- * A rewrite rule in a module other than the one defining -- the function in the head of the rule -- type WhetherHasOrphans = Bool diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index 931c9b218f..9edd0ff871 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -2184,7 +2184,7 @@ instance Outputable ForeignExport where {- ************************************************************************ * * -\subsection{Transformation rules} +\subsection{Rewrite rules} * * ************************************************************************ -} diff --git a/compiler/GHC/HsToCore.hs b/compiler/GHC/HsToCore.hs index b3266ece76..408cf6439d 100644 --- a/compiler/GHC/HsToCore.hs +++ b/compiler/GHC/HsToCore.hs @@ -354,7 +354,7 @@ to the binders in the top-level bindings Reason - It makes the rules easier to look up - - It means that transformation rules and specialisations for + - It means that rewrite rules and specialisations for locally defined Ids are handled uniformly - It keeps alive things that are referred to only from a rule (the occurrence analyser knows about rules attached to Ids) @@ -368,7 +368,7 @@ Reason ************************************************************************ * * -* Desugaring transformation rules +* Desugaring rewrite rules * * ************************************************************************ -} diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs index 5f82f6935a..18f2c9071e 100644 --- a/compiler/GHC/Rename/HsType.hs +++ b/compiler/GHC/Rename/HsType.hs @@ -23,8 +23,8 @@ module GHC.Rename.HsType ( checkPrecMatch, checkSectionPrec, -- Binding related stuff - bindLHsTyVarBndr, bindLHsTyVarBndrs, rnImplicitBndrs, - bindSigTyVarsFV, bindHsQTyVars, bindLRdrNames, + bindLHsTyVarBndr, bindLHsTyVarBndrs, WarnUnusedForalls(..), + rnImplicitBndrs, bindSigTyVarsFV, bindHsQTyVars, bindLRdrNames, extractHsTyRdrTyVars, extractHsTyRdrTyVarsKindVars, extractHsTysRdrTyVarsDups, extractRdrKindSigVars, extractDataDefnKindVars, @@ -41,9 +41,10 @@ import GHC.Driver.Session import GHC.Hs import GHC.Rename.Doc ( rnLHsDoc, rnMbLHsDoc ) import GHC.Rename.Env -import GHC.Rename.Utils ( HsDocContext(..), withHsDocContext, mapFvRn - , pprHsDocContext, bindLocalNamesFV, typeAppErr - , newLocalBndrRn, checkDupRdrNames, checkShadowedRdrNames ) +import GHC.Rename.Utils ( HsDocContext(..), inHsDocContext, withHsDocContext + , mapFvRn, pprHsDocContext, bindLocalNamesFV + , typeAppErr, newLocalBndrRn, checkDupRdrNames + , checkShadowedRdrNames ) import GHC.Rename.Fixity ( lookupFieldFixityRn, lookupFixityRn , lookupTyFixityRn ) import GHC.Tc.Utils.Monad @@ -203,9 +204,10 @@ rnWcBody ctxt nwc_rdrs hs_ty rn_ty :: RnTyKiEnv -> HsType GhcPs -> RnM (HsType GhcRn, FreeVars) -- A lot of faff just to allow the extra-constraints wildcard to appear - rn_ty env hs_ty@(HsForAllTy { hst_fvf = fvf, hst_bndrs = tvs - , hst_body = hs_body }) - = bindLHsTyVarBndrs (rtke_ctxt env) (Just $ inTypeDoc hs_ty) Nothing tvs $ \ tvs' -> + rn_ty env (HsForAllTy { hst_fvf = fvf, hst_bndrs = tvs + , hst_body = hs_body }) + = bindLHsTyVarBndrs (rtke_ctxt env) WarnUnusedForalls + Nothing tvs $ \ tvs' -> do { (hs_body', fvs) <- rn_lty env hs_body ; return (HsForAllTy { hst_fvf = fvf, hst_xforall = noExtField , hst_bndrs = tvs', hst_body = hs_body' } @@ -534,7 +536,7 @@ rnHsTyKi :: RnTyKiEnv -> HsType GhcPs -> RnM (HsType GhcRn, FreeVars) rnHsTyKi env ty@(HsForAllTy { hst_fvf = fvf, hst_bndrs = tyvars , hst_body = tau }) = do { checkPolyKinds env ty - ; bindLHsTyVarBndrs (rtke_ctxt env) (Just $ inTypeDoc ty) + ; bindLHsTyVarBndrs (rtke_ctxt env) WarnUnusedForalls Nothing tyvars $ \ tyvars' -> do { (tau', fvs) <- rnLHsTyKi env tau ; return ( HsForAllTy { hst_fvf = fvf, hst_xforall = noExtField @@ -845,11 +847,9 @@ bindLRdrNames rdrs thing_inside --------------- bindHsQTyVars :: forall a b. HsDocContext - -> Maybe SDoc -- Just d => check for unused tvs - -- d is a phrase like "in the type ..." -> Maybe a -- Just _ => an associated type decl -> [Located RdrName] -- Kind variables from scope, no dups - -> (LHsQTyVars GhcPs) + -> LHsQTyVars GhcPs -> (LHsQTyVars GhcRn -> Bool -> RnM (b, FreeVars)) -- The Bool is True <=> all kind variables used in the -- kind signature are bound on the left. Reason: @@ -863,7 +863,7 @@ bindHsQTyVars :: forall a b. -- and (ii) mentioned in the kinds of hsq_bndrs -- (b) Bring type variables into scope -- -bindHsQTyVars doc mb_in_doc mb_assoc body_kv_occs hsq_bndrs thing_inside +bindHsQTyVars doc mb_assoc body_kv_occs hsq_bndrs thing_inside = do { let hs_tv_bndrs = hsQTvExplicit hsq_bndrs bndr_kv_occs = extractHsTyVarBndrsKVs hs_tv_bndrs @@ -888,7 +888,10 @@ bindHsQTyVars doc mb_in_doc mb_assoc body_kv_occs hsq_bndrs thing_inside ; implicit_kv_nms <- mapM (newTyVarNameRn mb_assoc) implicit_kvs ; bindLocalNamesFV implicit_kv_nms $ - bindLHsTyVarBndrs doc mb_in_doc mb_assoc hs_tv_bndrs $ \ rn_bndrs -> + bindLHsTyVarBndrs doc NoWarnUnusedForalls mb_assoc hs_tv_bndrs $ \ rn_bndrs -> + -- This is the only call site for bindLHsTyVarBndrs where we pass + -- NoWarnUnusedForalls, which suppresses -Wunused-foralls warnings. + -- See Note [Suppress -Wunused-foralls when binding LHsQTyVars]. do { traceRn "bindHsQTyVars" (ppr hsq_bndrs $$ ppr implicit_kv_nms $$ ppr rn_bndrs) ; thing_inside (HsQTvs { hsq_ext = implicit_kv_nms , hsq_explicit = rn_bndrs }) @@ -990,17 +993,50 @@ variable in (a :: k), later in the binding. (This mistake lead to #14710.) So tvs is {k,a} and kvs is {k}. NB: we do this only at the binding site of 'tvs'. + +Note [Suppress -Wunused-foralls when binding LHsQTyVars] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The WarnUnusedForalls flag controls whether bindLHsTyVarBndrs should warn about +explicit type variable binders that go unused (e.g., the `a` in +`forall a. Int`). We almost always want to warn about these, since unused type +variables can usually be deleted without any repercussions. There is one +exception to this rule, however: binding LHsQTyVars. Consider this example: + + data Proxy a = Proxy + +The `a` in `Proxy a` is bound by an LHsQTyVars, and the code which brings it +into scope, bindHsQTyVars, will invoke bindLHsTyVarBndrs in turn. As such, it +has a choice to make about whether to emit -Wunused-foralls warnings or not. +If it /did/ emit warnings, then the `a` would be flagged as unused. However, +this is not what we want! Removing the `a` in `Proxy a` would change its kind +entirely, which is a huge price to pay for fixing a warning. + +Unlike other forms of type variable binders, dropping "unused" variables in +an LHsQTyVars can be semantically significant. As a result, we suppress +-Wunused-foralls warnings in exactly one place: in bindHsQTyVars. -} +-- | Should GHC warn if a quantified type variable goes unused? Usually, the +-- answer is \"yes\", but in the particular case of binding 'LHsQTyVars', we +-- avoid emitting warnings. +-- See @Note [Suppress -Wunused-foralls when binding LHsQTyVars]@. +data WarnUnusedForalls + = WarnUnusedForalls + | NoWarnUnusedForalls + +instance Outputable WarnUnusedForalls where + ppr wuf = text $ case wuf of + WarnUnusedForalls -> "WarnUnusedForalls" + NoWarnUnusedForalls -> "NoWarnUnusedForalls" + bindLHsTyVarBndrs :: (OutputableBndrFlag flag) => HsDocContext - -> Maybe SDoc -- Just d => check for unused tvs - -- d is a phrase like "in the type ..." + -> WarnUnusedForalls -> Maybe a -- Just _ => an associated type decl -> [LHsTyVarBndr flag GhcPs] -- User-written tyvars -> ([LHsTyVarBndr flag GhcRn] -> RnM (b, FreeVars)) -> RnM (b, FreeVars) -bindLHsTyVarBndrs doc mb_in_doc mb_assoc tv_bndrs thing_inside +bindLHsTyVarBndrs doc wuf mb_assoc tv_bndrs thing_inside = do { when (isNothing mb_assoc) (checkShadowedRdrNames tv_names_w_loc) ; checkDupRdrNames tv_names_w_loc ; go tv_bndrs thing_inside } @@ -1014,9 +1050,9 @@ bindLHsTyVarBndrs doc mb_in_doc mb_assoc tv_bndrs thing_inside ; warn_unused b' fvs ; return (res, fvs) } - warn_unused tv_bndr fvs = case mb_in_doc of - Just in_doc -> warnUnusedForAll in_doc tv_bndr fvs - Nothing -> return () + warn_unused tv_bndr fvs = case wuf of + WarnUnusedForalls -> warnUnusedForAll doc tv_bndr fvs + NoWarnUnusedForalls -> return () bindLHsTyVarBndr :: HsDocContext -> Maybe a -- associated class @@ -1456,16 +1492,14 @@ dataKindsErr env thing pp_what | isRnKindLevel env = text "kind" | otherwise = text "type" -inTypeDoc :: HsType GhcPs -> SDoc -inTypeDoc ty = text "In the type" <+> quotes (ppr ty) - -warnUnusedForAll :: (OutputableBndrFlag flag) => SDoc -> LHsTyVarBndr flag GhcRn -> FreeVars -> TcM () -warnUnusedForAll in_doc (L loc tv) used_names +warnUnusedForAll :: OutputableBndrFlag flag + => HsDocContext -> LHsTyVarBndr flag GhcRn -> FreeVars -> TcM () +warnUnusedForAll doc (L loc tv) used_names = whenWOptM Opt_WarnUnusedForalls $ unless (hsTyVarName tv `elemNameSet` used_names) $ addWarnAt (Reason Opt_WarnUnusedForalls) loc $ vcat [ text "Unused quantified type variable" <+> quotes (ppr tv) - , in_doc ] + , inHsDocContext doc ] opTyErr :: Outputable a => RdrName -> a -> SDoc opTyErr op overall_ty diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs index 6c071217f8..5e9d4dec64 100644 --- a/compiler/GHC/Rename/Module.hs +++ b/compiler/GHC/Rename/Module.hs @@ -31,7 +31,7 @@ import GHC.Rename.HsType import GHC.Rename.Bind import GHC.Rename.Env import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, bindLocalNames - , checkDupRdrNames, inHsDocContext, bindLocalNamesFV + , checkDupRdrNames, bindLocalNamesFV , checkShadowedRdrNames, warnUnusedTypePatterns , extendTyVarEnvFVRn, newLocalBndrsRn , withHsDocContext ) @@ -720,7 +720,7 @@ rnFamInstEqn doc atfi rhs_kvars -- with a sensible binding location ; ((bndrs', pats', payload'), fvs) <- bindLocalNamesFV all_imp_var_names $ - bindLHsTyVarBndrs doc (Just $ inHsDocContext doc) + bindLHsTyVarBndrs doc WarnUnusedForalls Nothing bndrs $ \bndrs' -> -- Note: If we pass mb_cls instead of Nothing here, -- bindLHsTyVarBndrs will use class variables for any names @@ -1017,7 +1017,7 @@ rnHsRuleDecl (HsRule { rd_name = rule_name ; checkShadowedRdrNames rdr_names_w_loc ; names <- newLocalBndrsRn rdr_names_w_loc ; let doc = RuleCtx (snd $ unLoc rule_name) - ; bindRuleTyVars doc in_rule tyvs $ \ tyvs' -> + ; bindRuleTyVars doc tyvs $ \ tyvs' -> bindRuleTmVars doc tyvs' tmvs names $ \ tmvs' -> do { (lhs', fv_lhs') <- rnLExpr lhs ; (rhs', fv_rhs') <- rnLExpr rhs @@ -1033,7 +1033,6 @@ rnHsRuleDecl (HsRule { rd_name = rule_name get_var :: RuleBndr GhcPs -> Located RdrName get_var (RuleBndrSig _ v _) = v get_var (RuleBndr _ v) = v - in_rule = text "in the rule" <+> pprFullRuleName rule_name bindRuleTmVars :: HsDocContext -> Maybe ty_bndrs -> [LRuleBndr GhcPs] -> [Name] @@ -1059,17 +1058,17 @@ bindRuleTmVars doc tyvs vars names thing_inside bind_free_tvs = case tyvs of Nothing -> AlwaysBind Just _ -> NeverBind -bindRuleTyVars :: HsDocContext -> SDoc -> Maybe [LHsTyVarBndr () GhcPs] +bindRuleTyVars :: HsDocContext -> Maybe [LHsTyVarBndr () GhcPs] -> (Maybe [LHsTyVarBndr () GhcRn] -> RnM (b, FreeVars)) -> RnM (b, FreeVars) -bindRuleTyVars doc in_doc (Just bndrs) thing_inside - = bindLHsTyVarBndrs doc (Just in_doc) Nothing bndrs (thing_inside . Just) -bindRuleTyVars _ _ _ thing_inside = thing_inside Nothing +bindRuleTyVars doc (Just bndrs) thing_inside + = bindLHsTyVarBndrs doc WarnUnusedForalls Nothing bndrs (thing_inside . Just) +bindRuleTyVars _ _ thing_inside = thing_inside Nothing {- Note [Rule LHS validity checking] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Check the shape of a transformation rule LHS. Currently we only allow +Check the shape of a rewrite rule LHS. Currently we only allow LHSs of the form @(f e1 .. en)@, where @f@ is not one of the @forall@'d variables. @@ -1581,7 +1580,7 @@ rnTyClDecl (SynDecl { tcdLName = tycon, tcdTyVars = tyvars, ; let kvs = extractHsTyRdrTyVarsKindVars rhs doc = TySynCtx tycon ; traceRn "rntycl-ty" (ppr tycon <+> ppr kvs) - ; bindHsQTyVars doc Nothing Nothing kvs tyvars $ \ tyvars' _ -> + ; bindHsQTyVars doc Nothing kvs tyvars $ \ tyvars' _ -> do { (rhs', fvs) <- rnTySyn doc rhs ; return (SynDecl { tcdLName = tycon', tcdTyVars = tyvars' , tcdFixity = fixity @@ -1597,7 +1596,7 @@ rnTyClDecl (DataDecl ; let kvs = extractDataDefnKindVars defn doc = TyDataCtx tycon ; traceRn "rntycl-data" (ppr tycon <+> ppr kvs) - ; bindHsQTyVars doc Nothing Nothing kvs tyvars $ \ tyvars' no_rhs_kvs -> + ; bindHsQTyVars doc Nothing kvs tyvars $ \ tyvars' no_rhs_kvs -> do { (defn', fvs) <- rnDataDefn doc defn ; cusk <- data_decl_has_cusk tyvars' new_or_data no_rhs_kvs kind_sig ; let rn_info = DataDeclRn { tcdDataCusk = cusk @@ -1621,7 +1620,7 @@ rnTyClDecl (ClassDecl { tcdCtxt = context, tcdLName = lcls, -- Tyvars scope over superclass context and method signatures ; ((tyvars', context', fds', ats'), stuff_fvs) - <- bindHsQTyVars cls_doc Nothing Nothing kvs tyvars $ \ tyvars' _ -> do + <- bindHsQTyVars cls_doc Nothing kvs tyvars $ \ tyvars' _ -> do -- Checks for distinct tyvars { (context', cxt_fvs) <- rnContext cls_doc context ; fds' <- rnFds fds @@ -1878,7 +1877,7 @@ rnFamDecl mb_cls (FamilyDecl { fdLName = tycon, fdTyVars = tyvars , fdInjectivityAnn = injectivity }) = do { tycon' <- lookupLocatedTopBndrRn tycon ; ((tyvars', res_sig', injectivity'), fv1) <- - bindHsQTyVars doc Nothing mb_cls kvs tyvars $ \ tyvars' _ -> + bindHsQTyVars doc mb_cls kvs tyvars $ \ tyvars' _ -> do { let rn_sig = rnFamResultSig doc ; (res_sig', fv_kind) <- wrapLocFstM rn_sig res_sig ; injectivity' <- traverse (rnInjectivityAnn tyvars' res_sig') @@ -2080,7 +2079,7 @@ rnConDecl decl@(ConDeclH98 { con_name = name, con_ex_tvs = ex_tvs -- scoping we get. So no implicit binders at the existential forall ; let ctxt = ConDeclCtx [new_name] - ; bindLHsTyVarBndrs ctxt (Just (inHsDocContext ctxt)) + ; bindLHsTyVarBndrs ctxt WarnUnusedForalls Nothing ex_tvs $ \ new_ex_tvs -> do { (new_context, fvs1) <- rnMbContext ctxt mcxt ; (new_args, fvs2) <- rnConDeclDetails (unLoc new_name) ctxt args @@ -2118,11 +2117,11 @@ rnConDecl decl@(ConDeclGADT { con_names = names $ extractHsTvBndrs explicit_tkvs $ extractHsTysRdrTyVarsDups (theta ++ arg_tys ++ [res_ty]) - ; let ctxt = ConDeclCtx new_names - mb_ctxt = Just (inHsDocContext ctxt) + ; let ctxt = ConDeclCtx new_names ; rnImplicitBndrs implicit_bndrs $ \ implicit_tkvs -> - bindLHsTyVarBndrs ctxt mb_ctxt Nothing explicit_tkvs $ \ explicit_tkvs -> + bindLHsTyVarBndrs ctxt WarnUnusedForalls + Nothing explicit_tkvs $ \ explicit_tkvs -> do { (new_cxt, fvs1) <- rnMbContext ctxt mcxt ; (new_args, fvs2) <- rnConDeclDetails (unLoc (head new_names)) ctxt args ; (new_res_ty, fvs3) <- rnLHsType ctxt res_ty diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs index 19a7c57cfb..f7ab9496f5 100644 --- a/compiler/GHC/Rename/Utils.hs +++ b/compiler/GHC/Rename/Utils.hs @@ -495,7 +495,7 @@ pprHsDocContext PatCtx = text "a pattern type-signature" pprHsDocContext SpecInstSigCtx = text "a SPECIALISE instance pragma" pprHsDocContext DefaultDeclCtx = text "a `default' declaration" pprHsDocContext DerivDeclCtx = text "a deriving declaration" -pprHsDocContext (RuleCtx name) = text "the transformation rule" <+> ftext name +pprHsDocContext (RuleCtx name) = text "the rewrite rule" <+> doubleQuotes (ftext name) pprHsDocContext (TyDataCtx tycon) = text "the data type declaration for" <+> quotes (ppr tycon) pprHsDocContext (FamPatCtx tycon) = text "a type pattern of family instance for" <+> quotes (ppr tycon) pprHsDocContext (TySynCtx name) = text "the declaration for type synonym" <+> quotes (ppr name) diff --git a/compiler/GHC/Tc/Gen/Rule.hs b/compiler/GHC/Tc/Gen/Rule.hs index 63377c74d5..7475b2e737 100644 --- a/compiler/GHC/Tc/Gen/Rule.hs +++ b/compiler/GHC/Tc/Gen/Rule.hs @@ -7,7 +7,7 @@ {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeFamilies #-} --- | Typechecking transformation rules +-- | Typechecking rewrite rules module GHC.Tc.Gen.Rule ( tcRules ) where import GHC.Prelude @@ -239,7 +239,7 @@ tcRuleTmBndrs (L _ (RuleBndrSig _ (L _ name) rn_ty) : rule_bndrs) ; return (map snd tvs ++ tyvars, id : tmvars) } ruleCtxt :: FastString -> SDoc -ruleCtxt name = text "When checking the transformation rule" <+> +ruleCtxt name = text "When checking the rewrite rule" <+> doubleQuotes (ftext name) diff --git a/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr b/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr index 4ef380e5ba..44a0d34a33 100644 --- a/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr +++ b/testsuite/tests/dependent/should_fail/T16326_Fail10.stderr @@ -4,4 +4,4 @@ T16326_Fail10.hs:12:18: error: forall a -> a -> a (GHC does not yet support this) • In the type signature for ‘x’: forall a -> a -> a - When checking the transformation rule "flurmp" + When checking the rewrite rule "flurmp" diff --git a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr index 0a575c9bb3..5852074450 100644 --- a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr +++ b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr @@ -1,4 +1,4 @@ ExplicitForAllRules1.hs:49:31: warning: [-Wunused-foralls (in -Wextra)] Unused quantified type variable ‘b’ - in the rule "example7" + In the rewrite rule "example7" diff --git a/testsuite/tests/rename/should_compile/T5331.stderr b/testsuite/tests/rename/should_compile/T5331.stderr index fb27e64af1..d57daceb0a 100644 --- a/testsuite/tests/rename/should_compile/T5331.stderr +++ b/testsuite/tests/rename/should_compile/T5331.stderr @@ -9,4 +9,4 @@ T5331.hs:11:16: warning: [-Wunused-foralls (in -Wextra)] T5331.hs:13:13: warning: [-Wunused-foralls (in -Wextra)] Unused quantified type variable ‘a’ - In the type ‘forall a. Int’ + In the type signature for ‘f’ diff --git a/testsuite/tests/safeHaskell/ghci/p14.stderr b/testsuite/tests/safeHaskell/ghci/p14.stderr index 65baafe716..736e8b448c 100644 --- a/testsuite/tests/safeHaskell/ghci/p14.stderr +++ b/testsuite/tests/safeHaskell/ghci/p14.stderr @@ -1,6 +1,6 @@ <interactive>:9:25: error: - No instance for (Num a) arising from a use of ‘f’ - Possible fix: add (Num a) to the context of the RULE "id/Int" - In the expression: f - When checking the transformation rule "id/Int" + • No instance for (Num a) arising from a use of ‘f’ + Possible fix: add (Num a) to the context of the RULE "id/Int" + • In the expression: f + When checking the rewrite rule "id/Int" diff --git a/testsuite/tests/typecheck/should_compile/T10072.stderr b/testsuite/tests/typecheck/should_compile/T10072.stderr index 71a93c9573..994a03f903 100644 --- a/testsuite/tests/typecheck/should_compile/T10072.stderr +++ b/testsuite/tests/typecheck/should_compile/T10072.stderr @@ -7,4 +7,4 @@ T10072.hs:3:31: error: To use the inferred type, enable PartialTypeSignatures • In the type ‘a -> _’ In the type signature for ‘f’: a -> _ - When checking the transformation rule "map/empty" + When checking the rewrite rule "map/empty" diff --git a/testsuite/tests/typecheck/should_fail/T5853.stderr b/testsuite/tests/typecheck/should_fail/T5853.stderr index 6fd62bb79b..5d42625796 100644 --- a/testsuite/tests/typecheck/should_fail/T5853.stderr +++ b/testsuite/tests/typecheck/should_fail/T5853.stderr @@ -9,7 +9,7 @@ T5853.hs:15:52: error: bound by the RULE "map/map" at T5853.hs:15:2-57 NB: ‘Subst’ is a non-injective type family • In the expression: (f . g) <$> xs - When checking the transformation rule "map/map" + When checking the rewrite rule "map/map" • Relevant bindings include f :: Elem fa -> b (bound at T5853.hs:15:19) g :: a -> Elem fa (bound at T5853.hs:15:21) |