From e4a9911de84d0f5a0e45be64f248fc2da9843bf5 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sun, 25 Feb 2024 21:38:11 -0500 Subject: [PATCH] build-depends: ghc-lib-parser-ex >= 9.8.0.1 --- hlint.cabal | 2 +- src/.DS_Store | Bin 0 -> 6148 bytes src/Hint/Extensions.hs | 4 ++++ src/Hint/Lambda.hs | 4 +--- stack.yaml | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 src/.DS_Store diff --git a/hlint.cabal b/hlint.cabal index c070e3e1..72ac73ff 100644 --- a/hlint.cabal +++ b/hlint.cabal @@ -90,7 +90,7 @@ library build-depends: ghc-lib-parser == 9.8.* build-depends: - ghc-lib-parser-ex >= 9.8.0.0 && < 9.8.1 + ghc-lib-parser-ex >= 9.8.0.1 && < 9.8.1 if flag(gpl) build-depends: hscolour >= 1.21 diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..279384d9f7f9cc50ac8868d3bb3b24cc5315e1a2 GIT binary patch literal 6148 zcmeH~I}XA?3`A|9K%z-WxeW*41}i>-o(mvAR7ezvevi)h(-5dpgvOHn*4|i2rpU%3 zqO0d+Dbk6^6mFD-g`O$$vFv0o>+9ulKHcv(E4hu5R)BZX+s|!+3Qz$mKn17(6&R2L zd5}+M19~Pt3KgIN!%)D!4+UJKW5d|4G#L{2yZ_DNbD${!`-l7Yys9}3!(z!kATa-Km~rPzzfR) B5dZ)H literal 0 HcmV?d00001 diff --git a/src/Hint/Extensions.hs b/src/Hint/Extensions.hs index 2690ffb1..57cae8e6 100644 --- a/src/Hint/Extensions.hs +++ b/src/Hint/Extensions.hs @@ -428,6 +428,10 @@ used EmptyCase = hasS f f _ = False used KindSignatures = hasT (un :: HsKind GhcPs) used BangPatterns = hasS isPBangPat ||^ hasS isStrictMatch + where + -- Todo: Fix typing bug in ghc-lib-parser-ex. + isStrictMatch :: HsMatchContext GhcPs -> Bool + isStrictMatch = \case FunRhs{mc_strictness=SrcStrict} -> True; _ -> False used TemplateHaskell = hasS (not . isQuasiQuoteSplice) ||^ hasS isTypedSplice used TemplateHaskellQuotes = hasS f where diff --git a/src/Hint/Lambda.hs b/src/Hint/Lambda.hs index 443ec5f8..6fe25560 100644 --- a/src/Hint/Lambda.hs +++ b/src/Hint/Lambda.hs @@ -123,6 +123,7 @@ import GHC.Types.Name.Occurrence import GHC.Types.Name.Reader import GHC.Types.SrcLoc import Language.Haskell.GhclibParserEx.GHC.Hs.Expr (isTypeApp, isOpApp, isLambda, isQuasiQuoteExpr, isVar, isDol, strToVar) +import Language.Haskell.GhclibParserEx.GHC.Hs.Pat (isWildPat) import Language.Haskell.GhclibParserEx.GHC.Utils.Outputable import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader import GHC.Util.Brackets (isAtom) @@ -346,9 +347,6 @@ mkOrigPats funName pats = (zipWith munge vars pats', vars) in (used, (True, p)) | otherwise = (mempty, (False, p)) - isWildPat :: LPat GhcPs -> Bool - isWildPat = \case (L _ (WildPat _)) -> True; _ -> False - -- Replace the pattern with a variable pattern if the pattern doesn't contain wildcards. munge :: String -> (Bool, LPat GhcPs) -> LPat GhcPs munge _ (True, p) = p diff --git a/stack.yaml b/stack.yaml index b6aaeff4..da00fc76 100644 --- a/stack.yaml +++ b/stack.yaml @@ -6,7 +6,7 @@ packages: extra-deps: - ghc-lib-parser-9.8.1.20231009 - - ghc-lib-parser-ex-9.8.0.0 + - ghc-lib-parser-ex-9.8.0.1 # To test hlint against experimental builds of ghc-lib-parser-ex, # modify extra-deps like this: # - archive: /users/shayne/project/ghc-lib-parser-ex/ghc-lib-parser-ex-8.10.0.18.tar.gz