diff --git a/Language/Haskell/GhcMod/Check.hs b/Language/Haskell/GhcMod/Check.hs index 6d30f55..ea2e28a 100644 --- a/Language/Haskell/GhcMod/Check.hs +++ b/Language/Haskell/GhcMod/Check.hs @@ -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 diff --git a/Language/Haskell/GhcMod/Logger.hs b/Language/Haskell/GhcMod/Logger.hs index 0263561..d3b712b 100644 --- a/Language/Haskell/GhcMod/Logger.hs +++ b/Language/Haskell/GhcMod/Logger.hs @@ -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:"