Remove redundant typed hole warnings
This commit is contained in:
parent
7612229cc0
commit
6b62117381
@ -9,7 +9,7 @@ module Language.Haskell.GhcMod.Logger (
|
|||||||
import Bag (Bag, bagToList, emptyBag, consBag, filterBag, unionBags)
|
import Bag (Bag, bagToList, emptyBag, consBag, filterBag, unionBags)
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Data.IORef (IORef, newIORef, readIORef, writeIORef, modifyIORef)
|
import Data.IORef (IORef, newIORef, readIORef, writeIORef, modifyIORef)
|
||||||
import Data.List (isPrefixOf, find, nub)
|
import Data.List (isPrefixOf, find, nub, isInfixOf)
|
||||||
import Data.Maybe (fromMaybe, isJust)
|
import Data.Maybe (fromMaybe, isJust)
|
||||||
import ErrUtils (ErrMsg, WarnMsg, errMsgShortDoc, errMsgExtraInfo, mkPlainWarnMsg)
|
import ErrUtils (ErrMsg, WarnMsg, errMsgShortDoc, errMsgExtraInfo, mkPlainWarnMsg)
|
||||||
import Exception (ghandle)
|
import Exception (ghandle)
|
||||||
@ -167,11 +167,16 @@ sourceErrorBag err = return $ Left (srcErrorMessages err)
|
|||||||
|
|
||||||
mergeErrors :: DynFlags -> PprStyle -> Bag ErrMsg -> Bag ErrMsg -> (Bag ErrMsg, Bag ErrMsg)
|
mergeErrors :: DynFlags -> PprStyle -> Bag ErrMsg -> Bag ErrMsg -> (Bag ErrMsg, Bag ErrMsg)
|
||||||
mergeErrors dflag style b1 b2 =
|
mergeErrors dflag style b1 b2 =
|
||||||
let b1Msgs = map (ppWarnMsg dflag style) (bagToList b1)
|
let b1Msgs = map (\err1 -> let m = ppWarnMsg dflag style err1 in (m, head $ lines m))
|
||||||
mustBeB2 = \err2 -> let msg2 = ppWarnMsg dflag style err2
|
(bagToList b1)
|
||||||
in not $ msg2 `elem` b1Msgs
|
mustBeB2 = \err2 -> let msg2 = ppWarnMsg dflag style err2
|
||||||
|
line2 = head $ lines msg2
|
||||||
|
in not . isJust $ find (\(msg1, line1) -> msg1 == msg2 || (line1 == line2 && isHoleMsg line1)) b1Msgs
|
||||||
in (b1, filterBag mustBeB2 b2)
|
in (b1, filterBag mustBeB2 b2)
|
||||||
|
|
||||||
|
isHoleMsg :: String -> Bool
|
||||||
|
isHoleMsg = isInfixOf "Found hole"
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
ppErrMsg :: DynFlags -> PprStyle -> ErrMsg -> String
|
ppErrMsg :: DynFlags -> PprStyle -> ErrMsg -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user