#ifdef GHCI /* Only if bootstrapped */
import {-# SOURCE #-} TcSplice( tcSpliceExpr, tcBracket )
-import TcEnv ( bracketOK )
+import HsSyn ( HsReify(..), ReifyFlavour(..) )
+import TcEnv ( bracketOK, tcMetaTy, tcLookupGlobal,
+ wellStaged, metaLevel )
import TcSimplify ( tcSimplifyBracket )
-import DsMeta ( liftName )
+import Name ( isExternalName )
+import qualified DsMeta
#endif
-import HsSyn ( HsExpr(..), HsLit(..), ArithSeqInfo(..),
+import HsSyn ( HsExpr(..), HsLit(..), ArithSeqInfo(..),
mkMonoBind, recBindFields
)
import RnHsSyn ( RenamedHsExpr, RenamedRecordBinds )
)
import TcBinds ( tcBindsAndThen )
import TcEnv ( tcLookupClass, tcLookupGlobal_maybe, tcLookupIdLvl,
- tcLookupTyCon, tcLookupDataCon, tcLookupId,
- wellStaged, metaLevel
+ tcLookupTyCon, tcLookupDataCon, tcLookupId
)
import TcMatches ( tcMatchesCase, tcMatchLambda, tcDoStmts )
import TcMonoType ( tcHsSigType, UserTypeCtxt(..) )
newTyVarTy, newTyVarTys, zonkTcType, readHoleResult )
import TcType ( TcType, TcSigmaType, TcRhoType, TyVarDetails(VanillaTv),
tcSplitFunTys, tcSplitTyConApp, mkTyVarTys,
- isSigmaTy, isTauTy, mkFunTy, mkFunTys,
+ isSigmaTy, mkFunTy, mkFunTys,
mkTyConApp, mkClassPred, tcFunArgTy,
tyVarsOfTypes, isLinearPred,
liftedTypeKind, openTypeKind,
import FieldLabel ( FieldLabel, fieldLabelName, fieldLabelType, fieldLabelTyCon )
import Id ( Id, idType, recordSelectorFieldLabel, isRecordSelector, isDataConWrapId_maybe )
import DataCon ( DataCon, dataConFieldLabels, dataConSig, dataConStrictMarks )
-import Name ( Name, isExternalName )
+import Name ( Name )
import TyCon ( TyCon, tyConTyVars, tyConTheta, isAlgTyCon, tyConDataCons )
import Subst ( mkTopTyVarSubst, substTheta, substTy )
import VarSet ( emptyVarSet, elemVarSet )
#ifdef GHCI /* Only if bootstrapped */
-- Rename excludes these cases otherwise
-tcMonoExpr (HsSplice n expr) res_ty = tcSpliceExpr n expr res_ty
+tcMonoExpr (HsSplice n expr loc) res_ty = addSrcLoc loc (tcSpliceExpr n expr res_ty)
-tcMonoExpr (HsBracket brack) res_ty
- = getStage `thenM` \ level ->
+tcMonoExpr (HsBracket brack loc) res_ty
+ = addSrcLoc loc $
+ getStage `thenM` \ level ->
case bracketOK level of {
Nothing -> failWithTc (illegalBracket level) ;
Just next_level ->
readMutVar pending_splices `thenM` \ pendings ->
returnM (HsBracketOut brack pendings)
}
+
+tcMonoExpr (HsReify (Reify flavour name)) res_ty
+ = addErrCtxt (ptext SLIT("At the reification of") <+> ppr name) $
+ tcMetaTy tycon_name `thenM` \ reify_ty ->
+ unifyTauTy res_ty reify_ty `thenM_`
+ returnM (HsReify (ReifyOut flavour name))
+ where
+ tycon_name = case flavour of
+ ReifyDecl -> DsMeta.decTyConName
+ ReifyType -> DsMeta.typTyConName
+ ReifyFixity -> pprPanic "tcMonoExpr: cant do reifyFixity yet" (ppr name)
#endif GHCI
\end{code}
-- just going to flag an error for now
setLIEVar lie_var (
- newMethodFromName orig id_ty liftName `thenM` \ lift ->
+ newMethodFromName orig id_ty DsMeta.liftName `thenM` \ lift ->
-- Put the 'lift' constraint into the right LIE
-- Update the pending splices
| want_method_inst fun_ty
= tcInstType VanillaTv fun_ty `thenM` \ (tyvars, theta, tau) ->
newMethodWithGivenTy orig fun_id
- (mkTyVarTys tyvars) theta tau `thenM` \ meth ->
- loop (HsVar (instToId meth)) tau
+ (mkTyVarTys tyvars) theta tau `thenM` \ meth_id ->
+ loop (HsVar meth_id) tau
loop fun fun_ty
| isSigmaTy fun_ty