X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnBinds.lhs;h=ced653a84e8a67973618dbb3fd83b637e2020fb3;hb=f7ecf7234c224489be8a5e63fced903b655d92ee;hp=f1618ad2dbeeb6a2dba8bbd08746aea63a61a0d3;hpb=26741ec416bae2c502ef00a2ba0e79050a32cb67;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnBinds.lhs b/ghc/compiler/rename/RnBinds.lhs index f1618ad..ced653a 100644 --- a/ghc/compiler/rename/RnBinds.lhs +++ b/ghc/compiler/rename/RnBinds.lhs @@ -15,8 +15,8 @@ module RnBinds ( rnTopBinds, rnMethodBinds, rnBinds, - FreeVars(..), - DefinedVars(..) + SYN_IE(FreeVars), + SYN_IE(DefinedVars) ) where IMP_Ubiq() @@ -32,14 +32,14 @@ import RnExpr ( rnMatch, rnGRHSsAndBinds, rnPat, checkPrecMatch ) import CmdLineOpts ( opt_SigsRequired ) import Digraph ( stronglyConnComp ) import ErrUtils ( addErrLoc, addShortErrLocLine ) -import Name ( RdrName ) +import Name ( getLocalName, RdrName ) import Maybes ( catMaybes ) -import PprStyle--ToDo:rm +--import PprStyle--ToDo:rm import Pretty import UniqSet ( emptyUniqSet, unitUniqSet, mkUniqSet, unionUniqSets, unionManyUniqSets, elementOfUniqSet, uniqSetToList, SYN_IE(UniqSet) ) -import Util ( thenCmp, isIn, removeDups, panic, panic#, assertPanic, pprTrace{-ToDo:rm-} ) +import Util ( thenCmp, isIn, removeDups, panic, panic#, assertPanic ) \end{code} -- ToDo: Put the annotations into the monad, so that they arrive in the proper @@ -524,7 +524,7 @@ rnBindSigs is_toplev binder_occnames sigs -- Discard unbound ones we've already complained about, so we -- complain about duplicate ones. - (goodies, dups) = removeDups compare (filter not_unbound sigs') + (goodies, dups) = removeDups compare (filter (\ x -> not_unbound x && not_main x) sigs') in mapRn (addErrRn . dupSigDeclErr) dups `thenRn_` @@ -598,7 +598,7 @@ rnBindSigs is_toplev binder_occnames sigs lookupValue v `thenRn` \ new_v -> returnRn (Just (MagicUnfoldingSig new_v str src_loc)) - not_unbound :: RenamedSig -> Bool + not_unbound, not_main :: RenamedSig -> Bool not_unbound (Sig n _ _ _) = not (isRnUnbound n) not_unbound (SpecSig n _ _ _) = not (isRnUnbound n) @@ -606,6 +606,10 @@ rnBindSigs is_toplev binder_occnames sigs not_unbound (DeforestSig n _) = not (isRnUnbound n) not_unbound (MagicUnfoldingSig n _ _) = not (isRnUnbound n) + not_main (Sig n _ _ _) = let str = getLocalName n in + not (str == SLIT("main") || str == SLIT("mainPrimIO")) + not_main _ = True + ------------------------------------- sig_free :: [RdrNameSig] -> RdrName -> Maybe RdrName -- Return "Just x" if "x" has no type signature in