diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-10-08 13:13:05 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-10-08 13:13:05 +0000 |
commit | e4df724b48c980b5507bb0d5e74d1f80beb9edeb (patch) | |
tree | ca7ef84accfcc407d5ab06129bccc40b7b97fa18 /compiler | |
parent | a6e73f94c732f3080329fd86ab5361531cb226b5 (diff) | |
download | haskell-e4df724b48c980b5507bb0d5e74d1f80beb9edeb.tar.gz |
FIX #1748: -main-is wasn't handling the case of a single hierarchical module
test case is driver062.5
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/DynFlags.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index a16b8b3ba8..65ddd2d65d 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -91,7 +91,7 @@ import Data.List ( isPrefixOf ) import Util ( split ) #endif -import Data.Char ( isUpper ) +import Data.Char import System.IO ( hPutStrLn, stderr ) -- ----------------------------------------------------------------------------- @@ -1445,15 +1445,16 @@ setOptLevel n dflags setMainIs :: String -> DynP () setMainIs arg - | not (null main_fn) -- The arg looked like "Foo.baz" + | not (null main_fn) && isLower (head main_fn) + -- The arg looked like "Foo.Bar.baz" = upd $ \d -> d{ mainFunIs = Just main_fn, - mainModIs = mkModule mainPackageId (mkModuleName main_mod) } + mainModIs = mkModule mainPackageId (mkModuleName main_mod) } - | isUpper (head main_mod) -- The arg looked like "Foo" - = upd $ \d -> d{ mainModIs = mkModule mainPackageId (mkModuleName main_mod) } + | isUpper (head arg) -- The arg looked like "Foo" or "Foo.Bar" + = upd $ \d -> d{ mainModIs = mkModule mainPackageId (mkModuleName arg) } | otherwise -- The arg looked like "baz" - = upd $ \d -> d{ mainFunIs = Just main_mod } + = upd $ \d -> d{ mainFunIs = Just arg } where (main_mod, main_fn) = splitLongestPrefix arg (== '.') |