summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-12-29 18:45:16 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-12-30 16:27:49 +0000
commitdd689efd547cd70294471466408ceef18592185b (patch)
treef3845c2bd4091d1a1eb49098488e695610ff74e7
parent58a0b350bb891c7f14ee0fa32f6a81e64e42b530 (diff)
downloadhaskell-dd689efd547cd70294471466408ceef18592185b.tar.gz
changes
-rw-r--r--compiler/GHC/Tc/Deriv.hs9
-rw-r--r--compiler/GHC/Tc/Gen/HsType.hs54
-rw-r--r--compiler/GHC/Tc/Gen/Rule.hs10
-rw-r--r--compiler/GHC/Tc/TyCl.hs20
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs9
-rw-r--r--compiler/GHC/Tc/Utils/Env.hs6
-rw-r--r--testsuite/tests/dependent/should_fail/T13780a.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/T16344a.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T15870.stderr2
-rw-r--r--testsuite/tests/partial-sigs/should_compile/T12033.stderr10
-rw-r--r--testsuite/tests/polykinds/T16221a.stderr6
-rw-r--r--testsuite/tests/polykinds/T16245a.stderr4
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T10946_sk.stderr14
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T19482.stderr9
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T19752.stderr22
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T19760.stderr19
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T20063.stderr27
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T20680.hs26
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T20680.stderr9
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/all.T11
-rw-r--r--testsuite/tests/typecheck/should_compile/T9834.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr6
22 files changed, 197 insertions, 84 deletions
diff --git a/compiler/GHC/Tc/Deriv.hs b/compiler/GHC/Tc/Deriv.hs
index 5a74bd1585..10103fa16d 100644
--- a/compiler/GHC/Tc/Deriv.hs
+++ b/compiler/GHC/Tc/Deriv.hs
@@ -480,10 +480,9 @@ deriveClause rep_tc scoped_tvs mb_lderiv_strat deriv_preds err_ctxt
Just (tvs, ty) -> do
skol_info <- mkSkolemInfo (DerivSkol ty)
return $ (tcExtendTyVarEnv skol_info tvs, tvs)
- Nothing -> return (id, [])
+ Nothing -> return (\f -> f emptyTCvSubst [], [])
- pprTraceM "via_tvs" (ppr via_tvs)
- extend_by $
+ extend_by $ \_subst _vars ->
-- Moreover, when using DerivingVia one can bind type variables in
-- the `via` type as well, so these type variables must also be
-- brought into scope.
@@ -646,10 +645,10 @@ deriveStandalone (L loc (DerivDecl _ deriv_ty mb_lderiv_strat overlap_mode))
Just (tvs, ty) -> do
skol_info <- mkSkolemInfo (DerivSkol ty)
return $ (tcExtendTyVarEnv skol_info tvs, tvs)
- Nothing -> return (id, [])
+ Nothing -> return (\f -> f emptyTCvSubst [], [])
-- MP: Issue here because we don't yet have the Type to put in this hole
; (cls_tvs, deriv_ctxt, cls, inst_tys)
- <- extend_by $
+ <- extend_by $ \_subst _vars ->
tcStandaloneDerivInstType ctxt deriv_ty
; let mb_deriv_strat = fmap unLoc mb_lderiv_strat
tvs = via_tvs ++ cls_tvs
diff --git a/compiler/GHC/Tc/Gen/HsType.hs b/compiler/GHC/Tc/Gen/HsType.hs
index af66fb0a78..786fbd0f2a 100644
--- a/compiler/GHC/Tc/Gen/HsType.hs
+++ b/compiler/GHC/Tc/Gen/HsType.hs
@@ -127,8 +127,9 @@ import qualified GHC.LanguageExtensions as LangExt
import GHC.Data.Maybe
import GHC.Data.Bag( unitBag )
-import Data.List ( find, mapAccumL )
+import Data.List ( find )
import Control.Monad
+import Data.Bifunctor
{-
----------------------------
@@ -2592,23 +2593,10 @@ kcCheckDeclHeader_sig kisig name flav
--
-- Here we unify Maybe k ~ Maybe j
--- ; pprTraceM "invis_binders" (ppr invis_binders $$ ppr explicit_tv_prs $$ ppr r_ki $$ ppr m_res_ki)
-
- ; let skolemise_binders :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder)
- skolemise_binders subst (Named (Bndr tv vis)) =
-
-
- -- pprTrace "tyvar" (ppr tv $$ ppr (tyVarKind tv) $$ ppr subst $$ ppr (substTy subst $ tyVarKind tv)) $
- let tv' = (mkTcTyVar (tyVarName tv) (substTy subst $ tyVarKind tv) (vanillaSkolemTv skol_info))
- subst' = extendTvSubst subst tv (mkTyVarTy tv')
- in (subst', Named (Bndr tv' vis))
- skolemise_binders subst b = (subst, b)
-
; whenIsJust m_res_ki $ \res_ki -> do
- let (subst, _binders') = mapAccumL skolemise_binders emptyTCvSubst invis_binders
- discardResult $ -- See Note [discardResult in kcCheckDeclHeader_sig]
--- pprTrace "subst_ty" (ppr $ substTy subst r_ki)
- unifyKind Nothing (substTy subst r_ki) res_ki
+ discardResult $
+ tcExtendTyVarEnv skol_info (mapMaybe tyCoBinderVar_maybe invis_binders) $ \subst _vars -> -- See Note [discardResult in kcCheckDeclHeader_sig]
+ unifyKind Nothing (substTy subst r_ki) res_ki
; return (invis_binders, r_ki) }
@@ -3493,7 +3481,7 @@ When we /must/ clone.
bindTyClTyVars :: SkolemInfo
-> Name
- -> (TcTyCon -> [TyConBinder] -> Kind -> TcM a) -> TcM a
+ -> (TcTyCon -> [TyConBinder] -> [TcTyVar] -> TcKind -> TcM a) -> TcM a
-- ^ Used for the type variables of a type or class decl
-- in the "kind checking" and "type checking" pass,
-- but not in the initial-kind run.
@@ -3502,24 +3490,19 @@ bindTyClTyVars skol_info tycon_name thing_inside
; let scoped_prs = tcTyConScopedTyVars tycon
res_kind = tyConResKind tycon
binders = tyConBinders tycon
- ; let scoped_prs' = map skolemise_pair scoped_prs
+ -- ; pprTraceM "bindTyClTyVars" (ppr scoped_prs $$ ppr binders)
+-- ; let scoped_prs' = map skolemise_pair scoped_prs
-- ; lcl_env <- tcl_env <$> getLclEnv
-- ; th_body <- tcl_bndrs <$> getLclEnv
- ; let (_, binders') = mapAccumL skolemise_binders emptyTCvSubst binders
- ; tcExtendNameTyVarEnv scoped_prs' $
- thing_inside tycon binders' res_kind }
+-- ; let (_, binders') = mapAccumL skolemise_binders emptyTCvSubst binders
+ ;
+ tcExtendTyVarEnv skol_info (binderVars binders) $ \subst tc_vars ->
+ let scoped_prs' = map (second (expect_tv . substTyVar subst)) scoped_prs
+ in tcExtendNameTyVarEnv scoped_prs' $
+ thing_inside tycon binders tc_vars res_kind }
where
- skolemise_pair :: (Name, TyVar) -> (Name, TcTyVar)
- skolemise_pair (name, tyvar) = -- pprTrace "tyvar" (ppr tyvar $$ ppr (tyVarKind tyvar)) $
- (name, mkTcTyVar (tyVarName tyvar) (tyVarKind tyvar) (vanillaSkolemTv skol_info))
-
- skolemise_binders :: TCvSubst -> TyConBinder -> (TCvSubst, TyConBinder)
- skolemise_binders subst (Bndr tv vis) =
-
--- pprTrace "tyvar" (ppr tv $$ ppr (tyVarKind tv) $$ ppr subst $$ ppr (substTy subst $ tyVarKind tv)) $
- let tv' = (mkTcTyVar (tyVarName tv) (substTy subst $ tyVarKind tv) (vanillaSkolemTv skol_info))
- subst' = extendTvSubst subst tv (mkTyVarTy tv')
- in (subst', Bndr tv' vis)
+ expect_tv (TyVarTy tv ) = tv
+ expect_tv _ = panic "expect_tv"
{- *********************************************************************
@@ -3678,7 +3661,7 @@ Hence using zonked_kinds when forming tvs'.
-}
-----------------------------------
-etaExpandAlgTyCon :: [TyConBinder]
+etaExpandAlgTyCon :: [TyVar] -- Doesn't matter if these are TcTyVar or TyVar
-> Kind -- must be zonked
-> TcM ([TyConBinder], Kind)
-- GADT decls can have a (perhaps partial) kind signature
@@ -3690,7 +3673,7 @@ etaExpandAlgTyCon :: [TyConBinder]
-- It's a little trickier than you might think: see
-- Note [TyConBinders for the result kind signature of a data type]
-- See Note [Datatype return kinds] in GHC.Tc.TyCl
-etaExpandAlgTyCon tc_bndrs kind
+etaExpandAlgTyCon lhs_tvs kind
= do { loc <- getSrcSpanM
; uniqs <- newUniqueSupply
; rdr_env <- getLocalRdrEnv
@@ -3704,7 +3687,6 @@ etaExpandAlgTyCon tc_bndrs kind
subst = mkEmptyTCvSubst (mkInScopeSet (mkVarSet lhs_tvs))
; return (go loc new_occs new_uniqs subst [] kind) }
where
- lhs_tvs = map binderVar tc_bndrs
lhs_occs = map getOccName lhs_tvs
go loc occs uniqs subst acc kind
diff --git a/compiler/GHC/Tc/Gen/Rule.hs b/compiler/GHC/Tc/Gen/Rule.hs
index 5b96ca62a0..914e1cc653 100644
--- a/compiler/GHC/Tc/Gen/Rule.hs
+++ b/compiler/GHC/Tc/Gen/Rule.hs
@@ -28,7 +28,7 @@ import GHC.Tc.Types.Evidence( mkTcCoVarCo )
import GHC.Core.Type
import GHC.Core.TyCon( isTypeFamilyTyCon )
import GHC.Types.Id
-import GHC.Types.Var( EvVar )
+import GHC.Types.Var( EvVar, tyVarName )
import GHC.Types.Var.Set
import GHC.Types.Basic ( RuleName, NonStandardDefaultingStrategy(..) )
import GHC.Types.SrcLoc
@@ -156,6 +156,9 @@ tcRule (HsRule { rd_ext = ext
, ppr forall_tkvs
, ppr qtkvs
, ppr rule_ty
+ , ppr ty_bndrs
+ , ppr (
+ (qtkvs ++ tpl_ids))
, vcat [ ppr id <+> dcolon <+> ppr (idType id) | id <- tpl_ids ]
])
@@ -168,7 +171,6 @@ tcRule (HsRule { rd_ext = ext
lhs_evs residual_lhs_wanted
; (rhs_implic, rhs_binds) <- buildImplicationFor tc_lvl (getSkolemInfo skol_info) qtkvs
lhs_evs rhs_wanted
-
; emitImplications (lhs_implic `unionBags` rhs_implic)
; return $ HsRule { rd_ext = ext
, rd_name = rname
@@ -193,8 +195,8 @@ generateRuleConstraints rule_name ty_bndrs tm_bndrs lhs rhs
-- constraints, which we should not forget about.
-- It may mention the skolem type variables bound by
-- the RULE. c.f. #10072
-
- ; tcExtendTyVarEnv unkSkol tv_bndrs $
+-- ; pprTraceM "tv_bndrs" (ppr tv_bndrs)
+ ; tcExtendNameTyVarEnv [(tyVarName tv, tv) | tv <- tv_bndrs] $
tcExtendIdEnv id_bndrs $
do { -- See Note [Solve order for RULES]
((lhs', rule_ty), lhs_wanted) <- captureConstraints (tcInferRho lhs)
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index 9c282997f3..1519ccd04d 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -2431,14 +2431,14 @@ tcClassDecl1 roles_info class_name hs_ctxt meths fundeps sigs ats at_defs
= fixM $ \ clas ->
-- We need the knot because 'clas' is passed into tcClassATs
mkSkolemInfo skol_info_anon >>= \skol_info ->
- bindTyClTyVars skol_info class_name $ \ _ binders res_kind ->
+ bindTyClTyVars skol_info class_name $ \ _ binders binder_sks res_kind ->
do { checkClassKindSig res_kind
; traceTc "tcClassDecl 1" (ppr class_name $$ ppr binders)
; let tycon_name = class_name -- We use the same name
roles = roles_info tycon_name -- for TyCon and Class
; (ctxt, fds, sig_stuff, at_stuff)
- <- pushLevelAndSolveEqualities skol_info (binderVars binders) $
+ <- pushLevelAndSolveEqualities skol_info binder_sks $
-- The (binderVars binders) is needed bring into scope the
-- skolems bound by the class decl header (#17841)
do { ctxt <- tcHsContext hs_ctxt
@@ -2718,7 +2718,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info
, fdInjectivityAnn = inj })
| DataFamily <- fam_info
= mkSkolemInfo (TyConSkol (DataFamilyFlavour Nothing) tc_name) >>= \skol_info ->
- bindTyClTyVars skol_info tc_name $ \ _ binders res_kind -> do
+ bindTyClTyVars skol_info tc_name $ \ _ binders _skol_tvs res_kind -> do
{ traceTc "tcFamDecl1 data family:" (ppr tc_name)
; checkFamFlag tc_name
@@ -2746,7 +2746,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info
| OpenTypeFamily <- fam_info
=
mkSkolemInfo (TyConSkol (OpenTypeFamilyFlavour Nothing) tc_name) >>= \skol_info ->
- bindTyClTyVars skol_info tc_name $ \ _ binders res_kind -> do
+ bindTyClTyVars skol_info tc_name $ \ _ binders _skol_tvs res_kind -> do
{ traceTc "tcFamDecl1 open type family:" (ppr tc_name)
; checkFamFlag tc_name
; inj' <- tcInjectivity binders inj
@@ -2763,7 +2763,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info
-- the variables in the header scope only over the injectivity
-- declaration but this is not involved here
; (inj', binders, res_kind)
- <- bindTyClTyVars unkSkol tc_name $ \ _ binders res_kind ->
+ <- bindTyClTyVars unkSkol tc_name $ \ _ binders _skol_tvs res_kind ->
do { inj' <- tcInjectivity binders inj
; return (inj', binders, res_kind) }
@@ -2861,10 +2861,11 @@ tcInjectivity tcbs (Just (L loc (InjectivityAnn _ _ lInjNames)))
tcTySynRhs :: RolesInfo -> Name
-> LHsType GhcRn -> TcM TyCon
tcTySynRhs roles_info tc_name hs_ty
- = mkSkolemInfo skol_info_anon >>= \skol_info -> bindTyClTyVars skol_info tc_name $ \ _ binders res_kind ->
+ = mkSkolemInfo skol_info_anon >>= \skol_info -> bindTyClTyVars skol_info tc_name $ \ _ binders skol_tvs res_kind ->
do { env <- getLclEnv
; traceTc "tc-syn" (ppr tc_name $$ ppr (tcl_env env))
- ; rhs_ty <- pushLevelAndSolveEqualities skol_info (binderVars binders) $
+ ; rhs_ty <- pushLevelAndSolveEqualities skol_info skol_tvs $
+ --TODO: MP I think this should be TcKind, not Kind
tcCheckLHsType hs_ty (TheKind res_kind)
-- See Note [Error on unconstrained meta-variables] in GHC.Tc.Utils.TcMType
@@ -2897,7 +2898,7 @@ tcDataDefn err_ctxt roles_info tc_name
, dd_derivs = derivs })
=
mkSkolemInfo skol_info_anon >>= \skol_info ->
- bindTyClTyVars skol_info tc_name $ \ tctc tycon_binders res_kind ->
+ bindTyClTyVars skol_info tc_name $ \ tctc tycon_binders skol_tvs res_kind ->
-- 'tctc' is a 'TcTyCon' and has the 'tcTyConScopedTyVars' that we need
-- unlike the finalized 'tycon' defined above which is an 'AlgTyCon'
--
@@ -2908,14 +2909,13 @@ tcDataDefn err_ctxt roles_info tc_name
-- over GADT ConDecls as well; and it's awkward not to
do { gadt_syntax <- dataDeclChecks tc_name new_or_data ctxt cons
-- see Note [Datatype return kinds]
- ; (extra_bndrs, final_res_kind) <- etaExpandAlgTyCon tycon_binders res_kind
+ ; (extra_bndrs, final_res_kind) <- etaExpandAlgTyCon (binderVars tycon_binders) res_kind
; tcg_env <- getGblEnv
; let hsc_src = tcg_src tcg_env
; unless (mk_permissive_kind hsc_src cons) $
checkDataKindSig (DataDeclSort new_or_data) final_res_kind
- ; let skol_tvs = binderVars tycon_binders
; stupid_tc_theta <- pushLevelAndSolveEqualities skol_info skol_tvs $
tcHsContext ctxt
diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index 279567fbec..73053eefa0 100644
--- a/compiler/GHC/Tc/TyCl/Instance.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -691,10 +691,9 @@ tcDataFamInstDecl mb_clsinfo tv_skol_env
; gadt_syntax <- dataDeclChecks fam_name new_or_data hs_ctxt hs_cons
-- Do /not/ check that the number of patterns = tyConArity fam_tc
-- See [Arity of data families] in GHC.Core.FamInstEnv
- ; (qtvs, pats, unzonked_res_kind, res_kind, stupid_theta)
+ ; (qtvs, pats, _unzonked_res_kind, res_kind, stupid_theta)
<- tcDataFamInstHeader mb_clsinfo fam_tc outer_bndrs fixity
hs_ctxt hs_pats m_ksig new_or_data
--- ; pprTraceM "qtvs" (ppr qtvs)
-- Eta-reduce the axiom if possible
-- Quite tricky: see Note [Implementing eta reduction for data families]
; let (eta_pats, eta_tcbs) = eta_reduce fam_tc pats
@@ -718,7 +717,7 @@ tcDataFamInstDecl mb_clsinfo tv_skol_env
-- we did it before the "extra" tvs from etaExpandAlgTyCon
-- would always be eta-reduced
--
- ; (extra_tcbs, final_res_kind) <- etaExpandAlgTyCon full_tcbs res_kind
+ ; (extra_tcbs, final_res_kind) <- etaExpandAlgTyCon (binderVars full_tcbs) res_kind
-- Check the result kind; it may come from a user-written signature.
-- See Note [Datatype return kinds] in GHC.Tc.TyCl point 4(a)
@@ -740,11 +739,11 @@ tcDataFamInstDecl mb_clsinfo tv_skol_env
, text "eta_tcbs" <+> ppr eta_tcbs ]
; skol_info <- mkSkolemInfo FamInstSkol
; (rep_tc, axiom) <- fixM $ \ ~(rec_rep_tc, _) ->
- do { data_cons <- tcExtendTyVarEnv skol_info qtvs $
+ do { data_cons <- tcExtendTyVarEnv skol_info qtvs $ \subst _tvs ->
-- For H98 decls, the tyvars scope
-- over the data constructors
tcConDecls new_or_data (DDataInstance orig_res_ty)
- rec_rep_tc ty_binders unzonked_res_kind
+ rec_rep_tc ty_binders (substTy subst final_res_kind)
hs_cons
; rep_tc_name <- newFamInstTyConName lfam_name pats
diff --git a/compiler/GHC/Tc/Utils/Env.hs b/compiler/GHC/Tc/Utils/Env.hs
index e74258a6a3..0079a1692d 100644
--- a/compiler/GHC/Tc/Utils/Env.hs
+++ b/compiler/GHC/Tc/Utils/Env.hs
@@ -534,14 +534,16 @@ tcExtendKindEnv extra_env thing_inside
-----------------------
-- Scoped type and kind variables
-tcExtendTyVarEnv :: SkolemInfo -> [TyVar] -> TcM r -> TcM r
+tcExtendTyVarEnv :: SkolemInfo -> [TyVar] -> (TCvSubst -> [TcTyVar] -> TcM r) -> TcM r
tcExtendTyVarEnv skol_info tvs thing_inside
- = tcExtendNameTyVarEnv (snd $ mapAccumL go emptyTCvSubst tvs) thing_inside
+ = let (subst, tvs') = mapAccumL go emptyTCvSubst tvs
+ in tcExtendNameTyVarEnv tvs' (thing_inside subst (map snd tvs'))
where
go subst tv =
let tv' = mkTcTyVar (tyVarName tv) (substTy subst (tyVarKind tv)) (vanillaSkolemTv skol_info)
in (extendTvSubst subst tv (mkTyVarTy tv'), (tyVarName tv, tv'))
+
tcExtendNameTyVarEnv :: [(Name,TcTyVar)] -> TcM r -> TcM r
tcExtendNameTyVarEnv binds thing_inside
-- this should be used only for explicitly mentioned scoped variables.
diff --git a/testsuite/tests/dependent/should_fail/T13780a.stderr b/testsuite/tests/dependent/should_fail/T13780a.stderr
index 3e3fa61a9b..6cdcf96369 100644
--- a/testsuite/tests/dependent/should_fail/T13780a.stderr
+++ b/testsuite/tests/dependent/should_fail/T13780a.stderr
@@ -3,7 +3,7 @@ T13780a.hs:9:40: error:
• Couldn't match kind ‘a’ with ‘Bool’
Expected kind ‘Foo a’, but ‘MkFoo’ has kind ‘Foo Bool’
‘a’ is a rigid type variable bound by
- the data constructor ‘SMkFoo’
+ a family instance declaration
at T13780a.hs:9:20-31
• In the second argument of ‘(~)’, namely ‘MkFoo’
In the definition of data constructor ‘SMkFoo’
diff --git a/testsuite/tests/dependent/should_fail/T16344a.stderr b/testsuite/tests/dependent/should_fail/T16344a.stderr
index 8325bf4169..ab3b991293 100644
--- a/testsuite/tests/dependent/should_fail/T16344a.stderr
+++ b/testsuite/tests/dependent/should_fail/T16344a.stderr
@@ -2,7 +2,7 @@
T16344a.hs:11:36: error:
• Expected a type, but ‘a’ has kind ‘ka’
‘ka’ is a rigid type variable bound by
- the data constructor ‘MkT2’
+ the data type declaration for ‘T2’
at T16344a.hs:11:9-10
• In the second argument of ‘T2’, namely ‘a’
In the type ‘(T2 Type a)’
diff --git a/testsuite/tests/indexed-types/should_fail/T15870.stderr b/testsuite/tests/indexed-types/should_fail/T15870.stderr
index 7968dc3dda..198ec75797 100644
--- a/testsuite/tests/indexed-types/should_fail/T15870.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T15870.stderr
@@ -6,7 +6,7 @@ T15870.hs:32:34: error:
a :: k
Expected kind ‘Optic a’, but ‘g2’ has kind ‘Optic b’
‘k’ is a rigid type variable bound by
- a family instance declaration
+ the instance declaration
at T15870.hs:(27,1)-(32,35)
• In the second argument of ‘Get’, namely ‘g2’
In the type ‘Get a g2’
diff --git a/testsuite/tests/partial-sigs/should_compile/T12033.stderr b/testsuite/tests/partial-sigs/should_compile/T12033.stderr
index 780fb9d41b..9f9fdd6a17 100644
--- a/testsuite/tests/partial-sigs/should_compile/T12033.stderr
+++ b/testsuite/tests/partial-sigs/should_compile/T12033.stderr
@@ -1,15 +1,15 @@
T12033.hs:12:22: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘v -> t’
- Where: ‘t’ is a rigid type variable bound by
+ Where: ‘v’ is a rigid type variable bound by
+ the type signature for:
+ tripleStoreToRuleSet :: forall v. v -> v
+ at T12033.hs:6:1-30
+ ‘t’ is a rigid type variable bound by
the inferred types of
makeTuple :: v -> t
makeExpression :: v -> t
at T12033.hs:(11,4)-(13,39)
- ‘v’ is a rigid type variable bound by
- the type signature for:
- tripleStoreToRuleSet :: forall v. v -> v
- at T12033.hs:6:1-30
• In the type signature: makeExpression :: _
In an equation for ‘tripleStoreToRuleSet’:
tripleStoreToRuleSet getAtom
diff --git a/testsuite/tests/polykinds/T16221a.stderr b/testsuite/tests/polykinds/T16221a.stderr
index 5945369a6c..06fb5e0af1 100644
--- a/testsuite/tests/polykinds/T16221a.stderr
+++ b/testsuite/tests/polykinds/T16221a.stderr
@@ -1,11 +1,11 @@
T16221a.hs:6:49: error:
- • Expected kind ‘k’, but ‘b’ has kind ‘k2’
- ‘k2’ is a rigid type variable bound by
+ • Expected kind ‘k’, but ‘b’ has kind ‘k1’
+ ‘k1’ is a rigid type variable bound by
an explicit forall k (b :: k)
at T16221a.hs:6:20
‘k’ is a rigid type variable bound by
- the data constructor ‘MkT2’
+ the data type declaration for ‘T2’
at T16221a.hs:6:20
• In the second argument of ‘SameKind’, namely ‘b’
In the type ‘(SameKind a b)’
diff --git a/testsuite/tests/polykinds/T16245a.stderr b/testsuite/tests/polykinds/T16245a.stderr
index 0023432858..c47e088434 100644
--- a/testsuite/tests/polykinds/T16245a.stderr
+++ b/testsuite/tests/polykinds/T16245a.stderr
@@ -2,10 +2,10 @@
T16245a.hs:11:66: error:
• Expected kind ‘k’, but ‘b’ has kind ‘k1’
‘k1’ is a rigid type variable bound by
- the data constructor ‘MkT’
+ the newtype declaration for ‘T’
at T16245a.hs:11:12
‘k’ is a rigid type variable bound by
- the data constructor ‘MkT’
+ the newtype declaration for ‘T’
at T16245a.hs:11:1-67
• In the second argument of ‘SameKind’, namely ‘b’
In the type ‘(forall (b :: k). SameKind a b)’
diff --git a/testsuite/tests/typecheck/no_skolem_info/T10946_sk.stderr b/testsuite/tests/typecheck/no_skolem_info/T10946_sk.stderr
new file mode 100644
index 0000000000..d9ddf33946
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T10946_sk.stderr
@@ -0,0 +1,14 @@
+
+T10946_sk.hs:6:13: error:
+ • Found hole: _ :: a
+ Where: ‘a’ is a rigid type variable bound by
+ the type signature for:
+ m :: forall a. a -> a
+ at T10946_sk.hs:5:1-11
+ • In the Template Haskell quotation [|| _ ||]
+ In the expression: [|| _ ||]
+ In the Template Haskell splice $$([|| _ ||])
+ • Relevant bindings include
+ x :: a (bound at T10946_sk.hs:6:3)
+ m :: a -> a (bound at T10946_sk.hs:6:1)
+ Valid hole fits include x :: a (bound at T10946_sk.hs:6:3)
diff --git a/testsuite/tests/typecheck/no_skolem_info/T19482.stderr b/testsuite/tests/typecheck/no_skolem_info/T19482.stderr
new file mode 100644
index 0000000000..0c4b35f505
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T19482.stderr
@@ -0,0 +1,9 @@
+
+T19482.hs:11:25: error:
+ • Expected kind ‘[r]’, but ‘s’ has kind ‘r’
+ ‘r’ is a rigid type variable bound by
+ the instance declaration
+ at T19482.hs:10:10-35
+ • In the type ‘s’
+ In the expression: testF @r @s
+ In an equation for ‘bugList’: bugList = testF @r @s
diff --git a/testsuite/tests/typecheck/no_skolem_info/T19752.stderr b/testsuite/tests/typecheck/no_skolem_info/T19752.stderr
new file mode 100644
index 0000000000..fad985eb9b
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T19752.stderr
@@ -0,0 +1,22 @@
+
+T19752.hs:12:10: error:
+ • Could not deduce: F b0 ~ a
+ from the context: F b ~ a
+ bound by the type signature for:
+ f :: forall b. (F b ~ a) => a
+ at T19752.hs:12:10-23
+ Expected: forall b. (F b ~ a) => a
+ Actual: forall b. (F b ~ a) => a
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ g :: forall a. a
+ at T19752.hs:9:1-16
+ • In the ambiguity check for ‘f’
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature: f :: (F b ~ a) => a
+ In an equation for ‘g’:
+ g = f
+ where
+ f :: (F b ~ a) => a
+ f = undefined
+ • Relevant bindings include g :: a (bound at T19752.hs:10:1)
diff --git a/testsuite/tests/typecheck/no_skolem_info/T19760.stderr b/testsuite/tests/typecheck/no_skolem_info/T19760.stderr
new file mode 100644
index 0000000000..2f2c03d5c2
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T19760.stderr
@@ -0,0 +1,19 @@
+
+T19760.hs:11:41: error:
+ • Couldn't match kind ‘a'’ with ‘a’
+ Expected kind ‘Maybe a’, but ‘m'’ has kind ‘Maybe a'’
+ ‘a'’ is a rigid type variable bound by
+ an explicit forall a' (m' :: Maybe a')
+ at T19760.hs:11:18-19
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ f :: forall a (p :: Maybe a -> *) (m :: Maybe a). p m
+ at T19760.hs:8:1-56
+ • In the first argument of ‘p’, namely ‘m'’
+ In the type signature: go :: forall a' (m' :: Maybe a'). p m'
+ In an equation for ‘f’:
+ f = go
+ where
+ go :: forall a' (m' :: Maybe a'). p m'
+ go = undefined
+ • Relevant bindings include f :: p m (bound at T19760.hs:9:1)
diff --git a/testsuite/tests/typecheck/no_skolem_info/T20063.stderr b/testsuite/tests/typecheck/no_skolem_info/T20063.stderr
new file mode 100644
index 0000000000..cf0ecd073c
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T20063.stderr
@@ -0,0 +1,27 @@
+
+T20063.hs:25:21: error:
+ • Could not deduce: ctx4 ~ (ctx0 :*& l0)
+ from the context: (ctx1 ~ 'Extend ctx7, ctx2 ~ 'Extend ctx8)
+ bound by a pattern with constructor:
+ U :: forall {k} (ctx1 :: Context) (ctx2 :: Context) (l :: k).
+ Rn ctx1 ctx2 -> Rn (ctx1 :*& l) (ctx2 :*& l),
+ in an equation for ‘rnRename’
+ at T20063.hs:25:11-13
+ Expected: Idx ctx4
+ Actual: Idx (ctx0 :*& l0)
+ ‘ctx4’ is a rigid type variable bound by
+ the type signature for:
+ rnRename :: forall (ctx1 :: Context) (ctx2 :: Context)
+ (ctx3 :: Context) (ctx4 :: Context).
+ Rn ctx1 ctx2 -> Idx ctx3 -> Idx ctx4
+ at T20063.hs:24:1-48
+ • In the expression: T _
+ In an equation for ‘rnRename’: rnRename (U _) _ = T _
+ • Relevant bindings include
+ rnRename :: Rn ctx1 ctx2 -> Idx ctx3 -> Idx ctx4
+ (bound at T20063.hs:25:1)
+
+T20063.hs:26:17: error:
+ • The constructor ‘T’ should have 1 argument, but has been given none
+ • In the pattern: T
+ In an equation for ‘rnRename’: rnRename _ T = undefined
diff --git a/testsuite/tests/typecheck/no_skolem_info/T20680.hs b/testsuite/tests/typecheck/no_skolem_info/T20680.hs
new file mode 100644
index 0000000000..c7f5c6838a
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T20680.hs
@@ -0,0 +1,26 @@
+{-# language
+ DerivingStrategies
+ , DerivingVia
+ , GeneralisedNewtypeDeriving
+ , StandaloneDeriving
+#-}
+
+module T20690 (main) where
+
+import GHC.Exts (TYPE)
+import GHC.Generics (Rec1)
+import Data.Kind (Type)
+
+main :: IO ()
+main = pure ()
+
+class FunctorL (f :: Type -> TYPE r) where
+ fmapL :: (a -> b) -> (f a -> f b)
+
+newtype Base1 f a = Base1 { getBase1 :: f a }
+ deriving newtype (Functor)
+
+instance Functor f => FunctorL (Base1 f) where
+ fmapL = fmap
+
+deriving via (Base1 (Rec1 f)) instance FunctorL (Rec1 f)
diff --git a/testsuite/tests/typecheck/no_skolem_info/T20680.stderr b/testsuite/tests/typecheck/no_skolem_info/T20680.stderr
new file mode 100644
index 0000000000..c6a2d42bd4
--- /dev/null
+++ b/testsuite/tests/typecheck/no_skolem_info/T20680.stderr
@@ -0,0 +1,9 @@
+
+T20680.hs:26:50: error:
+ • Couldn't match kind ‘k’ with ‘*’
+ Expected kind ‘* -> *’, but ‘Rec1 f’ has kind ‘k -> *’
+ ‘k’ is a rigid type variable bound by
+ the deriving clause for ‘Base1 (Rec1 f)’
+ at T20680.hs:26:14-29
+ • In the first argument of ‘FunctorL’, namely ‘(Rec1 f)’
+ In the stand-alone deriving instance for ‘FunctorL (Rec1 f)’
diff --git a/testsuite/tests/typecheck/no_skolem_info/all.T b/testsuite/tests/typecheck/no_skolem_info/all.T
index 80b4db6a1b..37b77c1cee 100644
--- a/testsuite/tests/typecheck/no_skolem_info/all.T
+++ b/testsuite/tests/typecheck/no_skolem_info/all.T
@@ -1,5 +1,6 @@
-test('T19752', [expect_broken(19752), grep_errmsg('of unknown origin')], compile_fail, [''])
-test('T20063', [expect_broken(20063), grep_errmsg('of unknown origin')], compile_fail, [''])
-test('T19760', [expect_broken(19760), grep_errmsg('of unknown origin')], compile_fail, [''])
-test('T19482', [expect_broken(19482), grep_errmsg('of unknown origin')], compile_fail, [''])
-test('T10946_sk', [expect_broken(10946), grep_errmsg('of unknown origin')], compile_fail, [''])
+test('T19752', normal, compile_fail, [''])
+test('T20063', normal, compile_fail, [''])
+test('T19760', normal, compile_fail, [''])
+test('T19482', normal, compile_fail, [''])
+test('T10946_sk', normal, compile_fail, [''])
+test('T20680', normal, compile_fail, [''])
diff --git a/testsuite/tests/typecheck/should_compile/T9834.stderr b/testsuite/tests/typecheck/should_compile/T9834.stderr
index 2c410de0f2..6ad8956ecc 100644
--- a/testsuite/tests/typecheck/should_compile/T9834.stderr
+++ b/testsuite/tests/typecheck/should_compile/T9834.stderr
@@ -33,7 +33,9 @@ T9834.hs:23:23: warning: [-Wdeferred-type-errors (in -Wdefault)]
‘a’ is a rigid type variable bound by
the type signature for:
afix :: forall a.
- (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a)
+ (forall (q1 :: * -> *).
+ Applicative q1 =>
+ Comp p q1 a -> Comp p q1 a)
-> p a
at T9834.hs:22:11-74
• In the first argument of ‘wrapIdComp’, namely ‘f’
diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr
index df7865f8d4..86f65024af 100644
--- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr
+++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.stderr
@@ -3,7 +3,7 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:21:30: error:
• Couldn't match kind ‘t’ with ‘'IntRep’
Expected a type, but ‘Int#’ has kind ‘TYPE 'IntRep’
‘t’ is a rigid type variable bound by
- the data constructor ‘MkDF1a’
+ a family instance declaration
at UnliftedNewtypesUnassociatedFamilyFail.hs:21:1-33
• In the type ‘Int#’
In the definition of data constructor ‘MkDF1a’
@@ -13,7 +13,7 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:22:30: error:
• Couldn't match kind ‘t’ with ‘'WordRep’
Expected a type, but ‘Word#’ has kind ‘TYPE 'WordRep’
‘t’ is a rigid type variable bound by
- the data constructor ‘MkDF2a’
+ a family instance declaration
at UnliftedNewtypesUnassociatedFamilyFail.hs:22:1-34
• In the type ‘Word#’
In the definition of data constructor ‘MkDF2a’
@@ -25,7 +25,7 @@ UnliftedNewtypesUnassociatedFamilyFail.hs:23:30: error:
but ‘(# Int#, Word# #)’ has kind ‘TYPE
('TupleRep '[ 'IntRep, 'WordRep])’
‘t’ is a rigid type variable bound by
- the data constructor ‘MkDF3a’
+ a family instance declaration
at UnliftedNewtypesUnassociatedFamilyFail.hs:23:1-46
• In the type ‘(# Int#, Word# #)’
In the definition of data constructor ‘MkDF3a’