projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a6e73f9
)
FIX #1748: -main-is wasn't handling the case of a single hierarchical module
author
Simon Marlow
<simonmar@microsoft.com>
Mon, 8 Oct 2007 13:13:05 +0000
(13:13 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Mon, 8 Oct 2007 13:13:05 +0000
(13:13 +0000)
test case is driver062.5
compiler/main/DynFlags.hs
patch
|
blob
|
history
diff --git
a/compiler/main/DynFlags.hs
b/compiler/main/DynFlags.hs
index
a16b8b3
..
65ddd2d
100644
(file)
--- a/
compiler/main/DynFlags.hs
+++ b/
compiler/main/DynFlags.hs
@@
-91,7
+91,7
@@
import Data.List ( isPrefixOf )
import Util ( split )
#endif
import Util ( split )
#endif
-import Data.Char ( isUpper )
+import Data.Char
import System.IO ( hPutStrLn, stderr )
-- -----------------------------------------------------------------------------
import System.IO ( hPutStrLn, stderr )
-- -----------------------------------------------------------------------------
@@
-1445,15
+1445,16
@@
setOptLevel n dflags
setMainIs :: String -> DynP ()
setMainIs arg
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,
= 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"
| 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 (== '.')
where
(main_mod, main_fn) = splitLongestPrefix arg (== '.')