packages feed

ghc-lib-parser-ex 0.20201001 → 0.20201101

raw patch · 5 files changed

+44/−6 lines, 5 filesdep ~uniplatePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: uniplate

API changes (from Hackage documentation)

Files

ghc-lib-parser-ex.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.18 name:           ghc-lib-parser-ex-version:        0.20201001+version:        0.20201101 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@@ -105,6 +105,7 @@     , directory >= 1.3.3     , filepath >= 1.4.2     , extra >=1.6+    , uniplate >= 1.6.12     , ghc-lib-parser-ex   if flag(auto) && impl(ghc >= 8.10.0) && impl(ghc < 8.11.0)     build-depends:
src/Language/Haskell/GhclibParserEx/Fixity.hs view
@@ -18,7 +18,12 @@  #if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) import GHC.Hs+#if defined (GHCLIB_API_HEAD)+import GHC.Types.Fixity+import GHC.Types.SourceText+#else import GHC.Types.Basic+#endif import GHC.Types.Name.Reader import GHC.Types.Name import GHC.Types.SrcLoc
src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs view
@@ -22,7 +22,11 @@ import GHC.Parser.Header import GHC.Data.StringBuffer import GHC.Driver.Session+#if defined (GHCLIB_API_HEAD)+import GHC.Types.SourceError+#else import GHC.Driver.Types+#endif #else import Panic import HeaderInfo
src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs view
@@ -22,6 +22,9 @@ import HsSyn #endif #if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)+#if defined (GHCLIB_API_HEAD)+import GHC.Types.SourceText+#endif import GHC.Types.SrcLoc import GHC.Types.Name.Reader import GHC.Types.Name@@ -75,9 +78,12 @@   _ -> False isLCase = \case (L _ HsLamCase{}) -> True; _ -> False +#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_901)+isStrictMatch :: HsMatchContext GhcPs -> Bool+#else isStrictMatch :: HsMatchContext RdrName -> Bool-isStrictMatch FunRhs{mc_strictness=SrcStrict} = True-isStrictMatch _ = False+#endif+isStrictMatch = \case FunRhs{mc_strictness=SrcStrict} -> True; _ -> False  -- Field is punned e.g. '{foo}'. isFieldPun :: LHsRecField GhcPs (LHsExpr GhcPs) -> Bool@@ -98,10 +104,11 @@ isParComp :: StmtLR GhcPs GhcPs (LHsExpr GhcPs) -> Bool isParComp = \case ParStmt{} -> True; _ -> False -isMDo :: HsStmtContext Name -> Bool #if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)+isMDo :: HsStmtContext GhcRn -> Bool isMDo = \case MDoExpr _ -> True; _ -> False #else+isMDo :: HsStmtContext Name -> Bool isMDo = \case MDoExpr -> True; _ -> False #endif 
test/Test.hs view
@@ -16,6 +16,7 @@ import Control.Monad import Data.List.Extra import Data.Maybe+import Data.Generics.Uniplate.Data  import Language.Haskell.GhclibParserEx.Dump import Language.Haskell.GhclibParserEx.Fixity@@ -50,6 +51,7 @@ import GHC.Utils.Outputable #  if !defined (GHCLIB_API_900) import GHC.Driver.Ppr+import GHC.Parser.Errors.Ppr #  endif import GHC.Utils.Error import GHC.Types.Name.Reader@@ -99,11 +101,23 @@ chkParseResult :: (DynFlags -> WarningMessages -> String) -> DynFlags -> ParseResult a -> IO () chkParseResult report flags = \case     POk s _ -> do+#if defined (GHCLIB_API_HEAD)+      let (wrns, errs) = getMessages s+#else       let (wrns, errs) = getMessages s flags+#endif       when (not (null errs) || not (null wrns)) $+#if defined (GHCLIB_API_HEAD)+        assertFailure (report flags (fmap pprWarning wrns) ++ report flags (fmap pprError errs))+#else         assertFailure (report flags wrns ++ report flags errs)+#endif #if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)+#if defined (GHCLIB_API_HEAD)+    PFailed s -> assertFailure (report flags $ fmap pprError (snd (getMessages s)))+#else     PFailed s -> assertFailure (report flags $ snd (getMessages s flags))+#endif #else     PFailed _ loc err -> assertFailure (report flags $ unitBag $ mkPlainErrMsg flags loc err) #endif@@ -246,7 +260,7 @@   , testCase "isVar" $ test "foo" $ assert' . isVar   , testCase "isVar" $ test "3" $ assert' . not. isVar   , testCase "isPar" $ test "(foo)" $ assert' . isPar-  , testCase "isPar" $ test "foo" $ assert' . not. isPar+  , testCase "isPar" $ test "foo" $ assert' . not . isPar   , testCase "isApp" $ test "f x" $ assert' . isApp   , testCase "isApp" $ test "x" $ assert' . not . isApp   , testCase "isOpApp" $ test "l `op` r" $ assert' . isOpApp@@ -293,6 +307,7 @@   , testCase "isQuasiQuote" $ test "[expr(1 + 2)]" $ assert' . not . isQuasiQuote   , testCase "isWholeFrac" $ test "3.2e1" $ assert' . isWholeFrac . unLoc   , testCase "isWholeFrac" $ test "3.22e1" $ assert' . not . isWholeFrac . unLoc+  , testCase "isMDo" $ test "mdo { pure () }" $ assert' . any isMDo . universeBi   , testCase "strToVar" $ assert' . isVar . strToVar $ "foo"   , testCase "varToStr" $ test "[]" $ assert' . (== "[]") . varToStr   , testCase "varToStr" $ test "foo" $ assert' . (== "foo") . varToStr@@ -302,7 +317,13 @@     assert' = assertBool ""     test s = exprTest s flags     flags = foldl' xopt_set (defaultDynFlags fakeSettings fakeLlvmConfig)-              [ TemplateHaskell, TemplateHaskellQuotes, QuasiQuotes, TypeApplications, LambdaCase ]+              [ TemplateHaskell+              , TemplateHaskellQuotes+              , QuasiQuotes+              , TypeApplications+              , LambdaCase+              , RecursiveDo+              ]  patternPredicateTests :: TestTree patternPredicateTests = testGroup "Pattern predicate tests"