addCoverageTicksToBinds: tolerate a non-existent .hs file (#3803)
authorSimon Marlow <marlowsd@gmail.com>
Wed, 27 Jan 2010 11:32:05 +0000 (11:32 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 27 Jan 2010 11:32:05 +0000 (11:32 +0000)
compiler/deSugar/Coverage.lhs

index b161a21..52c0f04 100644 (file)
@@ -52,12 +52,10 @@ addCoverageTicksToBinds
         -> LHsBinds Id
         -> IO (LHsBinds Id, HpcInfo, ModBreaks)
 
-addCoverageTicksToBinds dflags mod mod_loc tyCons binds = do 
-
-  let orig_file = 
-             case ml_hs_file mod_loc of
-                   Just file -> file
-                   Nothing -> panic "can not find the original file during hpc trans"
+addCoverageTicksToBinds dflags mod mod_loc tyCons binds = 
+ case ml_hs_file mod_loc of
+ Nothing -> return (binds, emptyHpcInfo False, emptyModBreaks)
+ Just orig_file -> do
 
   if "boot" `isSuffixOf` orig_file then return (binds, emptyHpcInfo False, emptyModBreaks) else do