import RnTypes ( rnHsSigType, rnLHsType, rnHsTypeFVs,
rnLPat, rnPatsAndThen, patSigErr, checkPrecMatch )
import RnEnv ( bindLocatedLocalsRn, lookupLocatedBndrRn,
import RnTypes ( rnHsSigType, rnLHsType, rnHsTypeFVs,
rnLPat, rnPatsAndThen, patSigErr, checkPrecMatch )
import RnEnv ( bindLocatedLocalsRn, lookupLocatedBndrRn,
lookupLocatedSigOccRn, bindPatSigTyVarsFV,
bindLocalFixities, bindSigTyVarsFV,
warnUnusedLocalBinds, mapFvRn, extendTyVarEnvFVRn,
)
import DynFlags ( DynFlag(..) )
lookupLocatedSigOccRn, bindPatSigTyVarsFV,
bindLocalFixities, bindSigTyVarsFV,
warnUnusedLocalBinds, mapFvRn, extendTyVarEnvFVRn,
)
import DynFlags ( DynFlag(..) )
import NameEnv
import NameSet
import PrelNames ( isUnboundName )
import RdrName ( RdrName, rdrNameOcc )
import NameEnv
import NameSet
import PrelNames ( isUnboundName )
import RdrName ( RdrName, rdrNameOcc )
import ListSetOps ( findDupsEq )
import BasicTypes ( RecFlag(..) )
import Digraph ( SCC(..), stronglyConnComp )
import ListSetOps ( findDupsEq )
import BasicTypes ( RecFlag(..) )
import Digraph ( SCC(..), stronglyConnComp )
rnMethodBind cls sig_fn gen_tyvars (L loc (FunBind { fun_id = name, fun_infix = inf,
fun_matches = MatchGroup matches _ }))
= setSrcSpan loc $
rnMethodBind cls sig_fn gen_tyvars (L loc (FunBind { fun_id = name, fun_infix = inf,
fun_matches = MatchGroup matches _ }))
= setSrcSpan loc $
- = addErrAt loc $
- sep [ptext SLIT("Misplaced") <+> what_it_is <> colon, ppr sig]
+ = do { mod <- getModule
+ ; addErrAt loc $
+ vcat [sep [ptext SLIT("Misplaced") <+> what_it_is <> colon, ppr sig],
+ extra_stuff mod sig] }
+ extra_stuff mod (TypeSig (L _ n) _)
+ | nameIsLocalOrFrom mod n
+ = ptext SLIT("The type signature must be given where")
+ <+> quotes (ppr n) <+> ptext SLIT("is declared")
+ | otherwise
+ = ptext SLIT("You cannot give a type signature for an imported value")
+
+ extra_stuff mod other = empty