X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnNames.lhs;h=4a880ed1fb22bf9a0e630d54367a94fb60458173;hb=536852b1348fde6ec0ba13859cc5ddf8480a1653;hp=70150ca45ccca6d4db20a79a64d2a9cda369af40;hpb=beab356b7fbda6281351d7edd556d2e77a351cbf;p=ghc-hetmet.git diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index 70150ca..4a880ed 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -13,7 +13,7 @@ module RnNames ( #include "HsVersions.h" -import DynFlags ( DynFlag(..), GhcMode(..), DynFlags(..) ) +import DynFlags import HsSyn ( IE(..), ieName, ImportDecl(..), LImportDecl, ForeignDecl(..), HsGroup(..), HsValBinds(..), Sig(..), collectHsBindLocatedBinders, tyClDeclNames, @@ -69,6 +69,10 @@ rnImports imports (source, ordinary) = partition is_source_import imports is_source_import (L _ (ImportDecl _ is_boot _ _ _)) = is_boot + ifOptM Opt_WarnImplicitPrelude ( + when (notNull prel_imports) $ addWarn (implicitPreludeWarn) + ) + stuff1 <- mapM (rnImportDecl this_mod) (prel_imports ++ ordinary) stuff2 <- mapM (rnImportDecl this_mod) source let (decls, rdr_env, imp_avails) = combine (stuff1 ++ stuff2) @@ -708,10 +712,10 @@ rnExports explicit_mod exports -- written "module Main where ..." -- Reason: don't want to complain about 'main' not in scope -- in interactive mode - ; ghc_mode <- getGhcMode + ; dflags <- getDOpts ; let real_exports - | explicit_mod = exports - | ghc_mode == Interactive = Nothing + | explicit_mod = exports + | ghcLink dflags == LinkInMemory = Nothing | otherwise = Just ([noLoc (IEVar main_RDR_Unqual)]) -- ToDo: the 'noLoc' here is unhelpful if 'main' -- turns out to be out of scope @@ -1355,4 +1359,7 @@ nullModuleExport mod moduleDeprec mod txt = sep [ ptext SLIT("Module") <+> quotes (ppr mod) <+> ptext SLIT("is deprecated:"), nest 4 (ppr txt) ] + +implicitPreludeWarn + = ptext SLIT("Module `Prelude' implicitly imported") \end{code}