summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcTyClsDecls.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/typecheck/TcTyClsDecls.hs')
-rw-r--r--compiler/typecheck/TcTyClsDecls.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs
index 7f4b7c6b6e..8d8f254a3e 100644
--- a/compiler/typecheck/TcTyClsDecls.hs
+++ b/compiler/typecheck/TcTyClsDecls.hs
@@ -39,7 +39,7 @@ import TcTyDecls
import TcClassDcl
import {-# SOURCE #-} TcInstDcls( tcInstDecls1 )
import TcDeriv (DerivInfo(..))
-import TcUnify ( unifyKind )
+import TcUnify ( unifyKind, checkTvConstraints )
import TcHsType
import ClsInst( AssocInstInfo(..) )
import TcMType
@@ -2026,6 +2026,9 @@ tcClassDecl1 roles_info class_name hs_ctxt meths fundeps sigs ats at_defs
; (ctxt, fds, sig_stuff, at_stuff)
<- pushTcLevelM_ $
solveEqualities $
+ checkTvConstraints skol_info (binderVars binders) $
+ -- The checkTvConstraints is needed bring into scope the
+ -- skolems bound by the class decl header (#17841)
do { ctxt <- tcHsContext hs_ctxt
; fds <- mapM (addLocM tc_fundep) fundeps
; sig_stuff <- tcClassSigs class_name sigs meths
@@ -2058,6 +2061,7 @@ tcClassDecl1 roles_info class_name hs_ctxt meths fundeps sigs ats at_defs
ppr fds)
; return clas }
where
+ skol_info = TyConSkol ClassFlavour class_name
tc_fundep (tvs1, tvs2) = do { tvs1' <- mapM (tcLookupTyVar . unLoc) tvs1 ;
; tvs2' <- mapM (tcLookupTyVar . unLoc) tvs2 ;
; return (tvs1', tvs2') }