on master help sign in
Clarify ambiguous error message.
43027ccJan de Muijnck-Hughes
src/Idris/IBC.hs+16−3
@@ -362,9 +362,22 @@ process reexp phase archive fn = do
362 when (ver /= ibcVersion) $ do
362 when (ver /= ibcVersion) $ do
363 logIBC 1 "ibc out of date"
363 logIBC 1 "ibc out of date"
364 let e = if ver < ibcVersion
364 let e = if ver < ibcVersion
365− then " an earlier " else " a later "
365+ then "an earlier" else "a later"
366+ ldir <- runIO $ getIdrisLibDir
367+ let start = if ldir `L.isPrefixOf` fn
368+ then "This external module"
369+ else "This module"
370+ let end = case L.stripPrefix ldir fn of
371+ Nothing -> "Please clean and rebuild."
372+
373+ Just ploc -> unwords ["Please reinstall:", L.head $ splitDirectories ploc]
366− ifail $ "Incompatible ibc version.\nThis library was built with"
374+ ifail $ unlines [ unwords ["Incompatible ibc version for:", show fn]
375+ , unwords [start
376+ , "was built with"
377+ , e
367− ++ e ++ "version of Idris.\n" ++ "Please clean and rebuild."
378+ , "version of Idris."]
379+ , end
380+ ]
368 source <- getEntry "" "sourcefile" archive
381 source <- getEntry "" "sourcefile" archive
369 srcok <- runIO $ doesFileExist source
382 srcok <- runIO $ doesFileExist source
370 when srcok $ timestampOlder source fn
383 when srcok $ timestampOlder source fn