From ca26fe60260f3e52e82ec27c18a8aa5169cdcc89 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Mon, 28 Jul 2008 10:51:41 +0000 Subject: [PATCH] Complete the changes for #1205 Now ":load M" always searches for a module called "M", rather than using a file called "M.hs" if that exists. To get the file semantics (i.e. not loading "M.o"), use ":load M.hs". --- compiler/main/GHC.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index f005c60..26f13d1 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -454,6 +454,8 @@ guessTarget file (Just phase) guessTarget file Nothing | isHaskellSrcFilename file = return (Target (TargetFile file Nothing) Nothing) + | looksLikeModuleName file + = return (Target (TargetModule (mkModuleName file)) Nothing) | otherwise = do exists <- doesFileExist hs_file if exists @@ -463,7 +465,9 @@ guessTarget file Nothing if exists then return (Target (TargetFile lhs_file Nothing) Nothing) else do - return (Target (TargetModule (mkModuleName file)) Nothing) + throwDyn (ProgramError (showSDoc $ + text "target" <+> quotes (text file) <+> + text "is not a module name or a source file")) where hs_file = file <.> "hs" lhs_file = file <.> "lhs" -- 1.7.10.4