ghc-lib-parser-ex 9.8.0.1 → 9.8.0.2
raw patch · 4 files changed
+29/−4 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Language.Haskell.GhclibParserEx.GHC.Hs.Expr: isStrictMatch :: HsMatchContext RdrName -> Bool
+ Language.Haskell.GhclibParserEx.GHC.Hs.Expr: isStrictMatch :: HsMatchContext GhcPs -> Bool
Files
- ChangeLog.md +3/−0
- ghc-lib-parser-ex.cabal +1/−1
- src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs +3/−3
- test/Test.hs +22/−0
ChangeLog.md view
@@ -1,5 +1,8 @@ # Changelog for ghc-lib-parser-ex +## 9.8.0.2 released+- Fix broken cpp in `isStrictMatch`+ ## 9.8.0.1 released - New functions `isWildPat`
ghc-lib-parser-ex.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: ghc-lib-parser-ex-version: 9.8.0.1+version: 9.8.0.2 description: Please see the README on GitHub at <https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme> homepage: https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme bug-reports: https://github.com/shayne-fletcher/ghc-lib-parser-ex/issues
src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs view
@@ -138,12 +138,12 @@ isQuasiQuoteSplice = \case HsQuasiQuote{} -> True; _ -> False #if ( defined (GHC_8_10) || defined (GHC_8_8) )-isStrictMatch :: HsMatchContext GhcPs -> Bool-#elif ( defined (GHC_9_8) || defined (GHC_9_6) || defined (GHC_9_4) || defined (GHC_9_2) || defined (GHC_9_0) ) isStrictMatch :: HsMatchContext RdrName -> Bool+#elif ( defined (GHC_9_8) || defined (GHC_9_6) || defined (GHC_9_4) || defined (GHC_9_2) || defined (GHC_9_0) )+isStrictMatch :: HsMatchContext GhcPs -> Bool #else -- ghc > 9.8.1-isStrictMatch :: HsMatchContext (GenLocated SrcSpanAnnN RdrName) -> Bool+isStrictMatch :: HsMatchContext (LocatedN RdrName) -> Bool #endif isStrictMatch = \case FunRhs{mc_strictness=SrcStrict} -> True; _ -> False
test/Test.hs view
@@ -14,6 +14,7 @@ import qualified System.FilePath as FilePath import System.IO.Extra import Control.Monad+import Data.Data import Data.List.Extra import Data.Maybe import Data.Generics.Uniplate.Data@@ -109,6 +110,7 @@ , fixityTests , extendInstancesTests , expressionPredicateTests+ , declarationPredicateTests , typePredicateTests , patternPredicateTests , dynFlagsTests@@ -170,6 +172,9 @@ PFailed _ loc err -> assertFailure (report flags $ unitBag $ mkPlainErrMsg flags loc err) #endif +hasS :: (Data x, Data a) => (a -> Bool) -> x -> Bool+hasS test = any test . universeBi+ parseTests :: TestTree parseTests = testGroup "Parse tests" [@@ -251,6 +256,12 @@ POk _ e -> test e _ -> assertFailure "parse error" +declTest :: String -> DynFlags -> (LHsDecl GhcPs -> IO ()) -> IO ()+declTest s flags test =+ case parseDeclaration s flags of+ POk _ e -> test e+ _ -> assertFailure "parse error"+ stmtTest :: String -> DynFlags -> (LStmt GhcPs (LHsExpr GhcPs) -> IO ()) -> IO () stmtTest s flags test = case parseStatement s flags of@@ -333,6 +344,17 @@ where assert' = assertBool "" test_with_exts exts s = typeTest s (flags exts)+ flags = foldl' xopt_set basicDynFlags++declarationPredicateTests :: TestTree+declarationPredicateTests = testGroup "Declaration predicate tests"+ [+ testCase "isStrictMatch" $ test "x = e" $ assert' . not . hasS isStrictMatch+ , testCase "isStrictMatch" $ test "!x = e" $ assert' . hasS isStrictMatch+ ]+ where+ assert' = assertBool ""+ test s = declTest s (flags []) flags = foldl' xopt_set basicDynFlags expressionPredicateTests :: TestTree