[project @ 2005-05-23 09:56:03 by simonpj]
authorsimonpj <unknown>
Mon, 23 May 2005 09:56:03 +0000 (09:56 +0000)
committersimonpj <unknown>
Mon, 23 May 2005 09:56:03 +0000 (09:56 +0000)
Track new semantics of splitLongestPrefix; fixes -main-is bug

ghc/compiler/main/DynFlags.hs

index 09932b6..b916422 100644 (file)
@@ -65,7 +65,7 @@ import Data.List      ( isPrefixOf )
 #endif
 import Maybe           ( fromJust )
 import Char            ( isDigit, isUpper )
-
+import Outputable
 -- -----------------------------------------------------------------------------
 -- DynFlags
 
@@ -1043,18 +1043,17 @@ setOptLevel n dflags
 
 setMainIs :: String -> DynP ()
 setMainIs arg
-  | not (null main_mod)                -- The arg looked like "Foo.baz"
+  | not (null main_fn)         -- The arg looked like "Foo.baz"
   = upd $ \d -> d{ mainFunIs = Just main_fn,
                   mainModIs = Just main_mod }
 
-  | isUpper (head main_fn)     -- The arg looked like "Foo"
-  = upd $ \d -> d{ mainModIs = Just main_fn }
+  | isUpper (head main_mod)    -- The arg looked like "Foo"
+  = upd $ \d -> d{ mainModIs = Just main_mod }
   
   | otherwise                  -- The arg looked like "baz"
-  = upd $ \d -> d{ mainFunIs = Just main_fn }
+  = upd $ \d -> d{ mainFunIs = Just main_mod }
   where
     (main_mod, main_fn) = splitLongestPrefix arg (== '.')
-  
 
 -----------------------------------------------------------------------------
 -- Paths & Libraries