X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnNames.lhs;h=39ec541610ee5ec88d2623d9f5bf26c5c3ff3ab9;hb=e27a63d87e12d0ad1491ee372e025c65fcfd3d36;hp=9e163738f2cc687c8904df1daa3c44c4fc597e53;hpb=0c41772cba7ec3f558cd2619716c7db771eae935;p=ghc-hetmet.git diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index 9e16373..39ec541 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -70,10 +70,11 @@ rnImports imports 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,hpc_usage) = combine (stuff1 ++ stuff2) - return (decls, rdr_env, imp_avails,hpc_usage) + stuff1 <- mapM (rnImportDecl this_mod True) prel_imports + stuff2 <- mapM (rnImportDecl this_mod False) ordinary + stuff3 <- mapM (rnImportDecl this_mod False) source + let (decls, rdr_env, imp_avails, hpc_usage) = combine (stuff1 ++ stuff2 ++ stuff3) + return (decls, rdr_env, imp_avails, hpc_usage) where combine :: [(LImportDecl Name, GlobalRdrEnv, ImportAvails,AnyHpcUsage)] @@ -86,11 +87,11 @@ rnImports imports imp_avails1 `plusImportAvails` imp_avails2, hpc_usage1 || hpc_usage2) -rnImportDecl :: Module +rnImportDecl :: Module -> Bool -> LImportDecl RdrName -> RnM (LImportDecl Name, GlobalRdrEnv, ImportAvails,AnyHpcUsage) -rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot +rnImportDecl this_mod implicit_prelude (L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot qual_only as_mod imp_details)) = setSrcSpan loc $ do @@ -104,6 +105,11 @@ rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot imp_mod_name = unLoc loc_imp_mod_name doc = ppr imp_mod_name <+> ptext (sLit "is directly imported") + case imp_details of + Just _ -> return () + Nothing -> unless implicit_prelude $ + ifOptM Opt_WarnMissingImportList (addWarn (missingImportListWarn imp_mod_name)) + iface <- loadSrcInterface doc imp_mod_name want_boot mb_pkg -- Compiler sanity check: if the import didn't say @@ -1447,6 +1453,10 @@ nullModuleExport :: ModuleName -> SDoc nullModuleExport mod = ptext (sLit "The export item `module") <+> ppr mod <> ptext (sLit "' exports nothing") +missingImportListWarn :: ModuleName -> SDoc +missingImportListWarn mod + = ptext (sLit "The module") <+> quotes (ppr mod) <+> ptext (sLit "is missing an import list") + moduleWarn :: ModuleName -> WarningTxt -> SDoc moduleWarn mod (WarningTxt txt) = sep [ ptext (sLit "Module") <+> quotes (ppr mod) <> ptext (sLit ":"),