hlint 2.1.25 → 2.1.26
raw patch · 4 files changed
+22/−19 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +2/−0
- hlint.cabal +1/−1
- src/GHC/Util.hs +15/−16
- src/HSE/All.hs +4/−2
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for HLint (* = breaking change) +2.1.26, released 2019-06-26+ Make sure unknown extensions don't cause errors 2.1.25, released 2019-06-26 #681, fix for extensions on the command line not being used #686, suggest head (drop n x) ==> x !! max 0 n
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: hlint-version: 2.1.25+version: 2.1.26 license: BSD3 license-file: LICENSE category: Development
src/GHC/Util.hs view
@@ -11,7 +11,7 @@ , getMessages , SDoc , Located- , hseToGhcExtension+ , readExtension -- Temporary : Export these so GHC doesn't consider them unused and -- tell weeder to ignore them. , isAtom, addParen, paren, isApp, isOpApp, isAnyApp, isDot, isSection, isDotApp@@ -39,7 +39,6 @@ import Data.List import System.FilePath import Language.Preprocessor.Unlit-import qualified Language.Haskell.Exts.Extension as HSE import qualified Data.Map.Strict as Map fakeSettings :: Settings@@ -75,12 +74,7 @@ ] enabledExtensions :: [Extension]-enabledExtensions = [x | x <- [Cpp .. StarIsType], x `notElem` badExtensions]--- 'Cpp' are the first and last cases of type 'Extension' in--- 'libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs'. When we are--- on a version of GHC that has MR--- https://gitlab.haskell.org/ghc/ghc/merge_requests/826, we can--- replace them with 'minBound' and 'maxBound' respectively.+enabledExtensions = filter (`notElem` badExtensions) enumerateExtensions baseDynFlags :: DynFlags baseDynFlags = foldl' xopt_set@@ -207,11 +201,16 @@ isDotApp (OpApp _ _ (L _ op) _) = isDot op isDotApp _ = False --- | A mapping from 'HSE.KnownExtension' values to their--- 'GHC.LanguageExtensions.Type.Extension' equivalents.-hseToGhcExtension :: Map.Map HSE.KnownExtension Extension-hseToGhcExtension =- let ghcExts = Map.fromList [(show x, x) | x <- [Cpp .. StarIsType]]- in- Map.fromList [ (x, ext) | x <- [minBound .. maxBound]- , Just ext <- [Map.lookup (show x) ghcExts] ]+-- | All available GHC extensions+enumerateExtensions :: [Extension]+-- 'Cpp' are the first and last cases of type 'Extension' in+-- 'libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs'. When we are+-- on a version of GHC that has MR+-- https://gitlab.haskell.org/ghc/ghc/merge_requests/826, we can+-- replace them with 'minBound' and 'maxBound' respectively.+enumerateExtensions = [Cpp .. StarIsType]++-- | Parse a GHC extension+readExtension :: String -> Maybe Extension+readExtension x = Map.lookup x exts+ where exts = Map.fromList [(show x, x) | x <- [Cpp .. StarIsType]]
src/HSE/All.hs view
@@ -239,8 +239,10 @@ partitionEithers $ mapMaybe toEither exts where toEither ke = case ke of- EnableExtension e -> Left <$> Map.lookup e hseToGhcExtension- DisableExtension e -> Right <$> Map.lookup e hseToGhcExtension+ EnableExtension e -> Left <$> readExtension (show e)+ DisableExtension e -> Right <$> readExtension (show e)+ UnknownExtension ('N':'o':e) -> Right <$> readExtension e+ UnknownExtension e -> Left <$> readExtension e -- | Parse a Haskell module. Applies the C pre processor, and uses -- best-guess fixity resolution if there are ambiguities. The