Set Opt_DeferTypeErrors to rescure type errors. (#310)

Type errors are turned to warnings. We force to turn them to the errors again.
This commit is contained in:
Kazu Yamamoto 2014-08-14 14:13:09 +09:00
parent bc4bfe1752
commit 4f785d7f8a
2 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,7 @@ check :: IOish m
=> [FilePath] -- ^ The target files.
-> GhcModT m (Either String String)
check fileNames = overrideGhcUserOptions $ \ghcOpts ->
withLogger (setAllWaringFlags . setNoMaxRelevantBindings) $ do
withLogger (setAllWaringFlags . setNoMaxRelevantBindings . Gap.setWarnTypedHoles . Gap.setDeferTypeErrors) $ do
_ <- G.setSessionDynFlags =<< addCmdOpts ghcOpts =<< G.getSessionDynFlags
setTargetFiles fileNames

View File

@ -105,7 +105,13 @@ ppMsg spn sev dflag style msg = prefix ++ cts
(line,col,_,_) <- Gap.getSrcSpan spn
file <- normalise <$> Gap.getSrcFile spn
let severityCaption = Gap.showSeverityCaption sev
return $ file ++ ":" ++ show line ++ ":" ++ show col ++ ":" ++ severityCaption
pref0
| typeWarning `isPrefixOf` cts = file ++ ":" ++ show line ++ ":" ++ show col ++ ":"
| otherwise = file ++ ":" ++ show line ++ ":" ++ show col ++ ":" ++ severityCaption
return pref0
-- DeferTypeErrors turns a type error to a warning.
-- So, let's turns it the error again.
typeWarning = "Couldn't match expected type"
checkErrorPrefix :: String
checkErrorPrefix = "Dummy:0:0:Error:"