on master help sign in
Clarify ambiguous error message.

+ Use of 'This' in an error message without clarifying what 'this' is is unhelpful. + When encountering an out of date `IBC` file, make sure to print the name of the out-dated `IBC` in question. + If the `IBC` file comes from an externally defined package, tell the user to reinstall the pakage.

commit43027cc51b24203a380d3068f2815d2c9738b598 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateWed 10 Aug 2016, 10:54 (10 years ago) parentf645488
1 file changed+16−3
src/Idris/IBC.hs+16−3
src/Idris/IBC.hs+16−3
@@ -362,9 +362,22 @@ process reexp phase archive fn = do
362362 when (ver /= ibcVersion) $ do
363363 logIBC 1 "ibc out of date"
364364 let e = if ver < ibcVersion
365− then " an earlier " else " a later "
366− ifail $ "Incompatible ibc version.\nThis library was built with"
367− ++ e ++ "version of Idris.\n" ++ "Please clean and rebuild."
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]
374+ ifail $ unlines [ unwords ["Incompatible ibc version for:", show fn]
375+ , unwords [start
376+ , "was built with"
377+ , e
378+ , "version of Idris."]
379+ , end
380+ ]
368381 source <- getEntry "" "sourcefile" archive
369382 srcok <- runIO $ doesFileExist source
370383 when srcok $ timestampOlder source fn