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:
parent
bc4bfe1752
commit
4f785d7f8a
@ -37,7 +37,7 @@ check :: IOish m
|
|||||||
=> [FilePath] -- ^ The target files.
|
=> [FilePath] -- ^ The target files.
|
||||||
-> GhcModT m (Either String String)
|
-> GhcModT m (Either String String)
|
||||||
check fileNames = overrideGhcUserOptions $ \ghcOpts ->
|
check fileNames = overrideGhcUserOptions $ \ghcOpts ->
|
||||||
withLogger (setAllWaringFlags . setNoMaxRelevantBindings) $ do
|
withLogger (setAllWaringFlags . setNoMaxRelevantBindings . Gap.setWarnTypedHoles . Gap.setDeferTypeErrors) $ do
|
||||||
_ <- G.setSessionDynFlags =<< addCmdOpts ghcOpts =<< G.getSessionDynFlags
|
_ <- G.setSessionDynFlags =<< addCmdOpts ghcOpts =<< G.getSessionDynFlags
|
||||||
setTargetFiles fileNames
|
setTargetFiles fileNames
|
||||||
|
|
||||||
|
@ -105,7 +105,13 @@ ppMsg spn sev dflag style msg = prefix ++ cts
|
|||||||
(line,col,_,_) <- Gap.getSrcSpan spn
|
(line,col,_,_) <- Gap.getSrcSpan spn
|
||||||
file <- normalise <$> Gap.getSrcFile spn
|
file <- normalise <$> Gap.getSrcFile spn
|
||||||
let severityCaption = Gap.showSeverityCaption sev
|
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 :: String
|
||||||
checkErrorPrefix = "Dummy:0:0:Error:"
|
checkErrorPrefix = "Dummy:0:0:Error:"
|
||||||
|
Loading…
Reference in New Issue
Block a user