import {-# SOURCE #-} TcSplice( tcSpliceExpr, tcBracket )
import HsSyn ( HsReify(..), ReifyFlavour(..) )
import TcType ( isTauTy )
-import TcEnv ( bracketOK, tcMetaTy, tcLookupGlobal,
- wellStaged, metaLevel )
+import TcEnv ( bracketOK, tcMetaTy, checkWellStaged, metaLevel )
import TcSimplify ( tcSimplifyBracket )
import Name ( isExternalName )
import qualified DsMeta
-- If 'x' occurs many times we may get many identical
-- bindings of the same splice proxy, but that doesn't
-- matter, although it's a mite untidy.
- -- NB: isExernalName is true of top level things,
- -- and false of nested bindings
+ --
+ -- NB: During type-checking, isExernalName is true of
+ -- top level things, and false of nested bindings
+ -- Top-level things don't need lifting.
let
id_ty = idType id
returnM (HsVar id, id_ty))
other ->
- let
- use_lvl = metaLevel use_stage
- in
- checkTc (wellStaged bind_lvl use_lvl)
- (badStageErr id bind_lvl use_lvl) `thenM_`
+ checkWellStaged (quotes (ppr id)) bind_lvl use_stage `thenM_`
#endif
-- This is the bit that handles the no-Template-Haskell case
case isDataConWrapId_maybe id of
arithSeqCtxt expr
= hang (ptext SLIT("In an arithmetic sequence:")) 4 (ppr expr)
-
-badStageErr id bind_lvl use_lvl
- = ptext SLIT("Stage error:") <+> quotes (ppr id) <+>
- hsep [ptext SLIT("is bound at stage") <+> ppr bind_lvl,
- ptext SLIT("but used at stage") <+> ppr use_lvl]
-
parrSeqCtxt expr
= hang (ptext SLIT("In a parallel array sequence:")) 4 (ppr expr)
header = ptext SLIT("Constructor") <+> quotes (ppr con) <+>
ptext SLIT("does not have the required strict field(s)")
-
missingFields :: DataCon -> [FieldLabel] -> SDoc
missingFields con fields
= ptext SLIT("Fields of") <+> quotes (ppr con) <+> ptext SLIT("not initialised:")