diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,8 @@
 # Changelog for ghc-lib-parser-ex
 
+## 0.20210501 released 2021-05-01
+- Update to `ghc-lib-0.20210501`
+
 ## 0.20210331 released 2021-02-31
 - Update to `ghc-lib-0.20210331`
 
diff --git a/cbits/ghclib_api.h b/cbits/ghclib_api.h
--- a/cbits/ghclib_api.h
+++ b/cbits/ghclib_api.h
@@ -1,15 +1,21 @@
 /*
-Copyright (c) 2020, Shayne Fletcher. All rights
-reserved. SPDX-License-Identifier: BSD-3-Clause.
+Copyright (c) 2020, 2021 Shayne Fletcher. All rights reserved.
+SPDX-License-Identifier: BSD-3-Clause.
  */
 
 #if !defined(GHCLIB_API_H)
 #  define GHCLIB_API_H
 
-#  if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_900) && !defined (GHCLIB_API_810) && !defined (GHCLIB_API_808)
+#  if !(defined (GHCLIB_API_HEAD)   \
+     || defined (GHCLIB_API_902)    \
+     || defined (GHCLIB_API_900)    \
+     || defined (GHCLIB_API_810)    \
+     || defined (GHCLIB_API_808))
 #    if defined(MIN_VERSION_ghc_lib_parser)
 #       if !MIN_VERSION_ghc_lib_parser( 1,  0,  0)
 #         define GHCLIB_API_HEAD
+#       elif MIN_VERSION_ghc_lib_parser(9,  2,  0)
+#         define GHCLIB_API_902
 #       elif MIN_VERSION_ghc_lib_parser(9,  0,  0)
 #         define GHCLIB_API_900
 #       elif MIN_VERSION_ghc_lib_parser(8, 10,  0)
@@ -20,8 +26,10 @@
 #         error Unsupported GHC API version
 #      endif
 #    else
-#      if __GLASGOW_HASKELL__   == 901
+#      if __GLASGOW_HASKELL__   == 903
 #        define GHCLIB_API_HEAD
+#      elif __GLASGOW_HASKELL__ == 902
+#        define GHCLIB_API_902
 #      elif __GLASGOW_HASKELL__ == 900
 #        define GHCLIB_API_900
 #      elif __GLASGOW_HASKELL__ == 810
@@ -33,5 +41,4 @@
 #      endif
 #    endif
 #  endif
-
 #endif
diff --git a/ghc-lib-parser-ex.cabal b/ghc-lib-parser-ex.cabal
--- a/ghc-lib-parser-ex.cabal
+++ b/ghc-lib-parser-ex.cabal
@@ -1,6 +1,6 @@
 cabal-version: >= 1.18
 name:           ghc-lib-parser-ex
-version:        0.20210331
+version:        0.20210501
 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
diff --git a/src/Language/Haskell/GhclibParserEx/Dump.hs b/src/Language/Haskell/GhclibParserEx/Dump.hs
--- a/src/Language/Haskell/GhclibParserEx/Dump.hs
+++ b/src/Language/Haskell/GhclibParserEx/Dump.hs
@@ -13,14 +13,14 @@
 module Language.Haskell.GhclibParserEx.Dump(
     showAstData
   , BlankSrcSpan(..)
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   , BlankEpAnnotations(..)
 #endif
 ) where
 
 #if !defined(MIN_VERSION_ghc_lib_parser)
 -- Using native ghc.
-#  if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_900) || defined (GHCLIB_API_810)
+#  if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined(GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs.Dump
 #  else
 import HsDumpAst
@@ -28,7 +28,7 @@
 #else
 -- Using ghc-lib-parser. Recent versions will include
 -- GHC.Hs.Dump (it got moved in from ghc-lib on 2020-02-05).
-# if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+# if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs.Dump
 #  else
 -- For simplicity, just assume it's missing from 8.8 ghc-lib-parser
@@ -43,7 +43,7 @@
 import Name
 import DataCon
 import SrcLoc
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
diff --git a/src/Language/Haskell/GhclibParserEx/Fixity.hs b/src/Language/Haskell/GhclibParserEx/Fixity.hs
--- a/src/Language/Haskell/GhclibParserEx/Fixity.hs
+++ b/src/Language/Haskell/GhclibParserEx/Fixity.hs
@@ -16,9 +16,9 @@
   , infixr_, infixl_, infix_, fixity
   ) where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Hs
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 import GHC.Types.Fixity
 import GHC.Types.SourceText
 #else
@@ -64,7 +64,7 @@
 -- LPat and Pat have gone through a lot of churn. See
 -- https://gitlab.haskell.org/ghc/ghc/merge_requests/1925 for details.
 patFix :: [(String, Fixity)] -> LPat GhcPs -> LPat GhcPs
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 patFix fixities (L loc (ConPat _ op (InfixCon pat1 pat2))) =
   L loc (mkConOpPat (getFixities fixities) op (findFixity' (getFixities fixities) op) pat1 pat2)
 #elif defined (GHCLIB_API_810)
@@ -78,7 +78,7 @@
 
 mkConOpPat ::
   [(String, Fixity)]
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   -> LocatedN RdrName
 #else
   -> Located RdrName
@@ -86,21 +86,21 @@
   -> Fixity
   -> LPat GhcPs -> LPat GhcPs
   -> Pat GhcPs
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 mkConOpPat fs op2 fix2 p1@(L loc (ConPat _ op1 (InfixCon p11 p12))) p2
 #elif defined (GHCLIB_API_810)
 mkConOpPat fs op2 fix2 p1@(L loc (ConPatIn op1 (InfixCon p11 p12))) p2
 #else
 mkConOpPat fs op2 fix2 p1@(dL->L loc (ConPatIn op1 (InfixCon p11 p12))) p2
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | nofix_error = ConPat noAnn op2 (InfixCon p1 p2)
 #elif defined (GHCLIB_API_900)
   | nofix_error = ConPat noExtField op2 (InfixCon p1 p2)
 #else
   | nofix_error = ConPatIn op2 (InfixCon p1 p2)
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | associate_right = ConPat noAnn op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2)))
 #elif defined (GHCLIB_API_900)
   | associate_right = ConPat noExtField op1 (InfixCon p11 (L loc (mkConOpPat fs op2 fix2 p12 p2)))
@@ -109,7 +109,7 @@
 #else
   | associate_right = ConPatIn op1 (InfixCon p11 (cL loc (mkConOpPat fs op2 fix2 p12 p2)))
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | otherwise = ConPat noAnn op2 (InfixCon p1 p2)
 #elif defined (GHCLIB_API_900)
   | otherwise = ConPat noExtField op2 (InfixCon p1 p2)
@@ -119,7 +119,7 @@
   where
     fix1 = findFixity' fs op1
     (nofix_error, associate_right) = compareFixity fix1 fix2
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 mkConOpPat _ op _ p1 p2 = ConPat noAnn op (InfixCon p1 p2)
 #elif defined (GHCLIB_API_900)
 mkConOpPat _ op _ p1 p2 = ConPat noExtField op (InfixCon p1 p2)
@@ -129,7 +129,7 @@
 
 mkOpApp ::
    [(String, Fixity)]
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
    -> SrcSpanAnnA
 #else
    -> SrcSpan
@@ -140,14 +140,14 @@
    -> LHsExpr GhcPs
 --      (e11 `op1` e12) `op2` e2
 mkOpApp fs loc e1@(L _ (OpApp x1 e11 op1 e12)) op2 fix2 e2
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | nofix_error = L loc (OpApp noAnn e1 op2 e2)
 #else
   | nofix_error = L loc (OpApp noExt e1 op2 e2)
 #endif
   | associate_right = L loc (OpApp x1 e11 op1 (mkOpApp fs loc' e12 op2 fix2 e2 ))
   where
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
     loc'= combineLocsA e12 e2
 #else
     loc'= combineLocs e12 e2
@@ -156,18 +156,18 @@
     (nofix_error, associate_right) = compareFixity fix1 fix2
 --      (- neg_arg) `op` e2
 mkOpApp fs loc e1@(L _ (NegApp _ neg_arg neg_name)) op2 fix2 e2
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | nofix_error = L loc (OpApp noAnn e1 op2 e2)
 #else
   | nofix_error = L loc (OpApp noExt e1 op2 e2)
 #endif
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | associate_right = L loc (NegApp noAnn (mkOpApp fs loc' neg_arg op2 fix2 e2) neg_name)
 #else
   | associate_right = L loc (NegApp noExt (mkOpApp fs loc' neg_arg op2 fix2 e2) neg_name)
 #endif
   where
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
     loc' = combineLocsA neg_arg e2
 #else
     loc' = combineLocs neg_arg e2
@@ -175,7 +175,7 @@
     (nofix_error, associate_right) = compareFixity negateFixity fix2
 --      e1 `op` - neg_arg
 mkOpApp _ loc e1 op1 fix1 e2@(L _ NegApp {}) -- NegApp can occur on the right.
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   | not associate_right  = L loc (OpApp noAnn e1 op1 e2)-- We *want* right association.
 #else
   | not associate_right  = L loc (OpApp noExt e1 op1 e2)-- We *want* right association.
@@ -183,7 +183,7 @@
   where
     (_, associate_right) = compareFixity fix1 negateFixity
  --     Default case, no rearrangment.
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 mkOpApp _ loc e1 op _fix e2 = L loc (OpApp noAnn e1 op e2)
 #else
 mkOpApp _ loc e1 op _fix e2 = L loc (OpApp noExt e1 op e2)
@@ -200,7 +200,7 @@
 findFixity :: [(String, Fixity)] -> LHsExpr GhcPs -> Fixity
 findFixity fs r = askFix fs (getIdent r) -- Expressions.
 
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 findFixity' :: [(String, Fixity)] -> LocatedN RdrName -> Fixity
 #else
 findFixity' :: [(String, Fixity)] -> Located RdrName -> Fixity
@@ -262,12 +262,12 @@
 fixity :: FixityDirection -> Int -> [String] -> [(String, Fixity)]
 fixity a p = map (,Fixity (SourceText "") p a)
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 fixitiesFromModule :: Located HsModule -> [(String, Fixity)]
 #else
 fixitiesFromModule :: Located (HsModule GhcPs) -> [(String, Fixity)]
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 fixitiesFromModule (L _ (HsModule _ _ _ _ _ decls _ _)) = concatMap f decls
 #elif defined (GHCLIB_API_900)
 fixitiesFromModule (L _ (HsModule _ _ _ _ decls _ _)) = concatMap f decls
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Flags.hs
@@ -3,7 +3,7 @@
 #include "ghclib_api.h"
 module Language.Haskell.GhclibParserEx.GHC.Driver.Flags () where
 
-#if !defined (GHCLIB_API_HEAD) && !defined (GHCLIB_API_900)
+#if !(defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900))
 import DynFlags
 #endif
 
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
@@ -17,12 +17,12 @@
 #if defined (GHCLIB_API_808) || defined (GHCLIB_API_810)
 import qualified GHC.LanguageExtensions as LangExt
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Utils.Panic
 import GHC.Parser.Header
 import GHC.Data.StringBuffer
 import GHC.Driver.Session
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 import GHC.Types.SourceError
 #else
 import GHC.Driver.Types
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs.hs
@@ -9,7 +9,7 @@
  )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Hs
 import GHC.Unit.Module
 import GHC.Types.SrcLoc
@@ -23,7 +23,7 @@
 import SrcLoc
 #endif
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 modName :: Located HsModule -> String
 #else
 modName :: Located (HsModule GhcPs) -> String
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Binds.hs
@@ -7,7 +7,7 @@
   )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs.Binds
 import GHC.Hs.Extension
 #else
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Decls.hs
@@ -7,12 +7,12 @@
     isNewType, isForD, isDerivD, isClsDefSig
   ) where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Types.SrcLoc
 #else
 import SrcLoc
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Expr.hs
@@ -16,13 +16,13 @@
   fromChar
   ) where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 import GHC.Types.SourceText
 #endif
 import GHC.Types.SrcLoc
@@ -78,7 +78,7 @@
   _ -> False
 isLCase = \case (L _ HsLamCase{}) -> True; _ -> False
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_901)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_901)
 isStrictMatch :: HsMatchContext GhcPs -> Bool
 #else
 isStrictMatch :: HsMatchContext RdrName -> Bool
@@ -104,7 +104,7 @@
 isParComp :: StmtLR GhcPs GhcPs (LHsExpr GhcPs) -> Bool
 isParComp = \case ParStmt{} -> True; _ -> False
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 isMDo :: HsStmtContext GhcRn -> Bool
 isMDo = \case MDoExpr _ -> True; _ -> False
 #else
@@ -145,7 +145,7 @@
 -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'.
 isFieldWildcard :: LHsRecField GhcPs (LHsExpr GhcPs) -> Bool
 isFieldWildcard = \case
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
   (L _ HsRecField {hsRecFieldArg=(L _ (HsUnboundVar _ s))}) -> occNameString s == "_"
 #elif defined (GHCLIB_API_810)
   (L _ HsRecField {hsRecFieldArg=(L _ (HsUnboundVar _ _))}) -> True
@@ -159,7 +159,7 @@
 isUnboxed = \case Unboxed -> True; _ -> False
 
 isWholeFrac :: HsExpr GhcPs -> Bool
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 isWholeFrac (HsLit _ (HsRat _ fl@FL{} _)) = denominator (rationalFromFractionalLit fl) == 1
 isWholeFrac (HsOverLit _ (OverLit _ (HsFractional fl@FL {}) _)) = denominator (rationalFromFractionalLit fl) == 1
 #else
@@ -177,7 +177,7 @@
 varToStr _ = ""
 
 strToVar :: String -> LHsExpr GhcPs
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 strToVar x = noLocA $ HsVar noExtField (noLocA $ mkRdrUnqual (mkVarOcc x))
 #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 strToVar x = noLoc $ HsVar noExtField (noLoc $ mkRdrUnqual (mkVarOcc x))
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/ExtendInstances.hs
@@ -18,9 +18,9 @@
 -- representations rather than the terms themselves, leads to
 -- identical results.
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Utils.Outputable
-#  if !defined(GHCLIB_API_900)
+#  if !defined(GHCLIB_API_HEAD) && !defined(GHCLIB_API_900)
 import GHC.Driver.Ppr
 #  endif
 #else
@@ -42,7 +42,7 @@
 -- string representations.
 toStr :: Data a => HsExtendInstances a -> String
 toStr (HsExtendInstances e) =
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
   showPprUnsafe $ showAstData BlankSrcSpan BlankEpAnnotations e
 #else
   showSDocUnsafe $ showAstData BlankSrcSpan e
@@ -60,7 +60,7 @@
 -- Use 'ppr' for 'Show'.
 instance Outputable a => Show (HsExtendInstances a) where
   show (HsExtendInstances e) =
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
     showPprUnsafe $ ppr e
 #else
     showSDocUnsafe $ ppr e
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/ImpExp.hs
@@ -14,7 +14,7 @@
   )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Hs.ImpExp
 import GHC.Types.Name.Reader
 #elif defined (GHCLIB_API_810)
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Pat.hs
@@ -11,12 +11,12 @@
   , isPFieldWildcard, isPWildcard, isPFieldPun, isPatTypeSig, isPBangPat, isPViewPat
  ) where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Types.SrcLoc
 import GHC.Builtin.Types
 import GHC.Types.Name.Reader
@@ -31,7 +31,7 @@
 #endif
 
 patToStr :: LPat GhcPs -> String
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
 patToStr (L _ (ConPat _ (L _ x) (PrefixCon [] []))) | occNameString (rdrNameOcc x) == "True" = "True"
 patToStr (L _ (ConPat _ (L _ x) (PrefixCon [] []))) | occNameString (rdrNameOcc x) == "False" = "False"
 patToStr (L _ (ConPat _ (L _ x) (PrefixCon [] []))) | occNameString (rdrNameOcc x) == "[]" = "[]"
@@ -56,12 +56,12 @@
 strToPat :: String -> LPat GhcPs
 strToPat z
   | z == "True"  =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
   noLocA $
 #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
   noLoc $
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
     ConPat noAnn (noLocA true_RDR) (PrefixCon [] [])
 #elif defined (GHCLIB_API_900)
     ConPat noExtField (noLoc true_RDR) (PrefixCon [])
@@ -69,12 +69,12 @@
     ConPatIn (noLoc true_RDR) (PrefixCon [])
 #endif
   | z == "False" =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
   noLocA $
 #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
   noLoc $
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
     ConPat noAnn (noLocA false_RDR) (PrefixCon [] [])
 #elif defined (GHCLIB_API_900)
     ConPat noExtField (noLoc false_RDR) (PrefixCon [])
@@ -82,12 +82,12 @@
     ConPatIn (noLoc false_RDR) (PrefixCon [])
 #endif
   | z == "[]"    =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
   noLocA $
 #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
   noLoc $
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
     ConPat noAnn (noLocA $ nameRdrName nilDataConName) (PrefixCon [] [])
 #elif defined (GHCLIB_API_900)
     ConPat noExtField (noLoc $ nameRdrName nilDataConName) (PrefixCon [])
@@ -95,7 +95,7 @@
     ConPatIn (noLoc $ nameRdrName nilDataConName) (PrefixCon [])
 #endif
   | otherwise =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
       noLocA $ VarPat noExtField (noLocA $ mkVarUnqual (fsLit z))
 #elif defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
       noLoc $ VarPat noExtField (noLoc $ mkVarUnqual (fsLit z))
@@ -104,7 +104,7 @@
 #endif
 
 fromPChar :: LPat GhcPs -> Maybe Char
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 fromPChar (L _ (LitPat _ (HsChar _ x))) = Just x
 #else
 fromPChar (dL -> L _ (LitPat _ (HsChar _ x))) = Just x
@@ -118,7 +118,7 @@
 
 -- Field has a '_' as in '{foo=_} or is punned e.g. '{foo}'.
 isPFieldWildcard :: LHsRecField GhcPs (LPat GhcPs) -> Bool
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 isPFieldWildcard (L _ HsRecField {hsRecFieldArg=L _ WildPat {}}) = True
 isPFieldWildcard (L _ HsRecField {hsRecPun=True}) = True
 isPFieldWildcard (L _ HsRecField {}) = False
@@ -129,7 +129,7 @@
 #endif
 
 isPWildcard :: LPat GhcPs -> Bool
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 isPWildcard (L _ (WildPat _)) = True
 #else
 isPWildcard (dL -> L _ (WildPat _)) = True
@@ -137,7 +137,7 @@
 isPWildcard _ = False
 
 isPFieldPun :: LHsRecField GhcPs (LPat GhcPs) -> Bool
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 isPFieldPun (L _ HsRecField {hsRecPun=True}) = True
 #else
 isPFieldPun (dL -> L _ HsRecField {hsRecPun=True}) = True
@@ -145,7 +145,7 @@
 isPFieldPun _ = False
 
 isPatTypeSig, isPBangPat, isPViewPat :: LPat GhcPs -> Bool
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 isPatTypeSig (L _ SigPat{}) = True; isPatTypeSig _ = False
 isPBangPat (L _ BangPat{}) = True; isPBangPat _ = False
 isPViewPat (L _ ViewPat{}) = True; isPViewPat _ = False
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Types.hs b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Types.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Hs/Types.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Hs/Types.hs
@@ -8,12 +8,12 @@
   , isTyQuasiQuote, isUnboxedTuple
   ) where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Types.SrcLoc
 #else
 import SrcLoc
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Parser.hs b/src/Language/Haskell/GhclibParserEx/GHC/Parser.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Parser.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Parser.hs
@@ -22,15 +22,15 @@
   )
   where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 import GHC.Driver.Config
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Parser.PostProcess
 import GHC.Driver.Session
 import GHC.Data.StringBuffer
@@ -64,19 +64,19 @@
     location = mkRealSrcLoc (mkFastString "<string>") 1 1
     buffer = stringToStringBuffer str
     parseState =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
       initParserState (initParserOpts flags) buffer location
 #else
       mkPState flags buffer location
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 parseModule :: String -> DynFlags -> ParseResult (Located HsModule)
 #else
 parseModule :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs))
 #endif
 parseModule = parse Parser.parseModule
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 parseSignature :: String -> DynFlags -> ParseResult (Located HsModule)
 #else
 parseSignature :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs))
@@ -96,7 +96,7 @@
 parseDeclaration = parse Parser.parseDeclaration
 
 parseExpression :: String -> DynFlags -> ParseResult (LHsExpr GhcPs)
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 parseExpression s flags =
   -- The need for annotations here came about first manifested with
   -- ghc-9.0.1
@@ -125,7 +125,7 @@
 parseStmt :: String -> DynFlags -> ParseResult (Maybe (LStmt GhcPs (LHsExpr GhcPs)))
 parseStmt = parse Parser.parseStmt
 
-#if defined(GHCLIB_API_HEAD)
+#if defined(GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
 parseIdentifier :: String -> DynFlags -> ParseResult (LocatedN RdrName)
 #else
 parseIdentifier :: String -> DynFlags -> ParseResult (Located RdrName)
@@ -135,14 +135,14 @@
 parseType :: String -> DynFlags -> ParseResult (LHsType GhcPs)
 parseType = parse Parser.parseType
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 parseHeader :: String -> DynFlags -> ParseResult (Located HsModule)
 #else
 parseHeader :: String -> DynFlags -> ParseResult (Located (HsModule GhcPs))
 #endif
 parseHeader = parse Parser.parseHeader
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 parseFile :: String
           -> DynFlags
           -> String
@@ -159,7 +159,7 @@
     location = mkRealSrcLoc (mkFastString filename) 1 1
     buffer = stringToStringBuffer str
     parseState =
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
       initParserState (initParserOpts flags) buffer location
 #else
       mkPState flags buffer location
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs b/src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Settings/Config.hs
@@ -11,7 +11,7 @@
   )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Settings.Config
 import GHC.Driver.Session
 import GHC.Utils.Fingerprint
@@ -32,12 +32,14 @@
 
 fakeSettings :: Settings
 fakeSettings = Settings
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
   { sGhcNameVersion=ghcNameVersion
   , sFileSettings=fileSettings
   , sTargetPlatform=platform
   , sPlatformMisc=platformMisc
+#  if !defined(GHCLIB_API_HEAD)
   , sPlatformConstants=platformConstants
+#  endif
   , sToolSettings=toolSettings
   }
 #else
@@ -49,7 +51,7 @@
   }
 #endif
   where
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
     toolSettings = ToolSettings {
       toolSettings_opt_P_fingerprint=fingerprint0
       }
@@ -62,7 +64,7 @@
 #endif
     platform =
       Platform{
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
     -- It doesn't matter what values we write here as these fields are
     -- not referenced for our purposes. However the fields are strict
     -- so we must say something.
@@ -73,12 +75,15 @@
       , platformIsCrossCompiling=False
       , platformLeadingUnderscore=False
       , platformTablesNextToCode=False
-#  if !defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD)
+      , platform_constants = Nothing
+#endif
+#if !defined(GHCLIB_API_HEAD) && !defined (GHCLIB_API_900)
       , platformConstants=platformConstants
-#  endif
+#endif
       ,
 #endif
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902)
         platformWordSize=PW8
       , platformArchOS=ArchOS {archOS_arch=ArchUnknown, archOS_OS=OSUnknown}
 #elif defined (GHCLIB_API_810) || defined (GHCLIB_API_900)
@@ -90,10 +95,12 @@
 #endif
       , platformUnregisterised=True
       }
+#if !defined(GHCLIB_API_HEAD)
     platformConstants =
       PlatformConstants{pc_DYNAMIC_BY_DEFAULT=False,pc_WORD_SIZE=8}
+#endif
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)|| defined (GHCLIB_API_810)
 fakeLlvmConfig :: LlvmConfig
 fakeLlvmConfig = LlvmConfig [] []
 #else
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs b/src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Types/Name/Reader.hs
@@ -9,7 +9,7 @@
  )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Types.SrcLoc
 import GHC.Types.Name
 import GHC.Types.Name.Reader
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs b/src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Utils/Outputable.hs
@@ -8,9 +8,9 @@
 )
 where
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined(GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Utils.Outputable
-#if !defined (GHCLIB_API_900)
+#if !defined(GHCLIB_API_HEAD) && !defined (GHCLIB_API_900)
 import GHC.Driver.Ppr
 #endif
 #else
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -17,6 +17,10 @@
 import Data.List.Extra
 import Data.Maybe
 import Data.Generics.Uniplate.Data
+#if defined (GHCLIB_API_HEAD)
+import GHC.Data.Bag
+import GHC.Parser.Errors.Types
+#endif
 
 import Language.Haskell.GhclibParserEx.Dump
 import Language.Haskell.GhclibParserEx.Fixity
@@ -39,16 +43,16 @@
 import Language.Haskell.GhclibParserEx.GHC.Driver.Session
 import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 import GHC.Hs
 #else
 import HsSyn
 #endif
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 import GHC.Types.SrcLoc
 import GHC.Driver.Session
 import GHC.Parser.Lexer
-# if !defined (GHCLIB_API_HEAD)
+# if !(defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902))
 import GHC.Utils.Outputable
 #endif
 #  if !defined (GHCLIB_API_900)
@@ -95,22 +99,30 @@
     writeFile relPath contents
     return relPath
 
+#if defined (GHCLIB_API_HEAD)
+chkParseResult :: (DynFlags -> Bag (MsgEnvelope PsMessage)  -> String) -> DynFlags -> ParseResult a -> IO ()
+#else
 chkParseResult :: (DynFlags -> WarningMessages -> String) -> DynFlags -> ParseResult a -> IO ()
+#endif
 chkParseResult report flags = \case
     POk s _ -> do
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
       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 (mkParserWarn flags) wrns) ++ report flags (fmap mkParserErr errs))
+#elif defined (GHCLIB_API_902)
         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) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900) || defined (GHCLIB_API_810)
 #if defined (GHCLIB_API_HEAD)
+    PFailed s -> assertFailure (report flags $ fmap mkParserErr (snd (getMessages s)))
+#elif defined (GHCLIB_API_902)
     PFailed s -> assertFailure (report flags $ fmap pprError (snd (getMessages s)))
 #else
     PFailed s -> assertFailure (report flags $ snd (getMessages s flags))
@@ -121,44 +133,53 @@
 
 parseTests :: TestTree
 parseTests = testGroup "Parse tests"
-  [ testCase "Module" $
-      chkParseResult report flags $
+  [
+    testCase "Module" $
+      chkParseResult report flags (
         parseModule (unlines
           [ "module Foo (readMany) where"
           , "import Data.List"
           , "import Data.Maybe"
           , "readMany = unfoldr $ listToMaybe . concatMap reads . tails"
-          ]) flags
+          ]) flags)
+  , testCase "Module" $
+      chkParseResult report flags (
+        parseModule (unlines
+          [ "module Foo (readMany) where"
+          , "import Data.List"
+          , "import Data.Maybe"
+          , "readMany = unfoldr $ listToMaybe . concatMap reads . tails"
+          ]) flags)
   , testCase "Signature" $
-      chkParseResult report flags $
+      chkParseResult report flags (
         parseSignature (unlines
           [ "signature Str where"
           , "data Str"
           , "empty :: Str"
           , "append :: Str -> Str -> Str"
-          ]) flags
+          ]) flags)
   , testCase "Import" $
-      chkParseResult report flags $
-        parseImport "import qualified \"foo-lib\" Foo as Bar hiding ((<.>))" flags
+      chkParseResult report flags (
+        parseImport "import qualified \"foo-lib\" Foo as Bar hiding ((<.>))" flags)
   , testCase "Statement" $
-      chkParseResult report flags $
-        parseStatement "Foo foo <- bar" flags
+      chkParseResult report flags (
+        parseStatement "Foo foo <- bar" flags)
   , testCase "Backpack" $
-      chkParseResult report flags $
+      chkParseResult report flags (
         parseBackpack (unlines
           [ "unit main where"
           , "  module Main where"
           , "    main = putStrLn \"Hello world!\""
-          ]) flags
+          ]) flags)
   , testCase "Expression" $
-      chkParseResult report flags $
-        parseExpression "unfoldr $ listToMaybe . concatMap reads . tails" flags
+      chkParseResult report flags (
+        parseExpression "unfoldr $ listToMaybe . concatMap reads . tails" flags)
   , testCase "Declaration (1)" $
-      chkParseResult report flags $
-        parseDeclaration "fact n = if n <= 1 then 1 else n * fact (n - 1)" flags
+      chkParseResult report flags (
+        parseDeclaration "fact n = if n <= 1 then 1 else n * fact (n - 1)" flags)
   , testCase "Declaration (2)" $ -- Example from https://github.com/ndmitchell/hlint/issues/842.
-      chkParseResult report flags $
-        parseDeclaration "infixr 4 <%@~" flags
+      chkParseResult report flags (
+        parseDeclaration "infixr 4 <%@~" flags)
   , testCase "File" $ withTempDir $ \tmpDir -> do
       foo <- makeFile (tmpDir </> "Foo.hs") $ unlines
         ["{-# LANGUAGE ScopedTypeVariables #-}"
@@ -170,17 +191,17 @@
       s <- readFile' foo
       parsePragmasIntoDynFlags flags ([], []) foo s >>= \case
         Left msg -> assertFailure msg
-        Right flags -> chkParseResult report flags $ parseFile foo flags s
+        Right flags -> chkParseResult report flags (parseFile foo flags s)
   ]
   where
     flags = defaultDynFlags fakeSettings fakeLlvmConfig
-#if defined (GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
     report flags msgs = concat [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLoc msgs ]
 #else
     report flags msgs = concat [ showSDoc flags msg | msg <- pprErrMsgBagWithLoc msgs ]
 #endif
 
-#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_900)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902) || defined (GHCLIB_API_900)
 moduleTest :: String -> DynFlags -> (Located HsModule -> IO ()) -> IO ()
 #else
 moduleTest :: String -> DynFlags -> (Located (HsModule GhcPs) -> IO ()) -> IO ()
@@ -208,7 +229,7 @@
       exprTest "1 + 2 * 3" flags
         (\e ->
             assertBool "parse tree not affected" $
-#if defined(GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
               showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations e) /=
               showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations (applyFixities [] e))
 #else
@@ -220,7 +241,7 @@
       case parseDeclaration "f (1 : 2 :[]) = 1" flags of
         POk _ d ->
           assertBool "parse tree not affected" $
-#if defined(GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
           showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations d) /=
           showSDocUnsafe (showAstData BlankSrcSpan BlankEpAnnotations (applyFixities [] d))
 #else
@@ -376,7 +397,7 @@
       -- https://github.com/ndmitchell/hlint/issues/971).
       parsePragmasIntoDynFlags flags ([StarIsType], []) foo s >>= \case
         Left msg -> assertFailure msg
-        Right flags -> chkParseResult report flags $ parseFile foo flags s
+        Right flags -> chkParseResult report flags (parseFile foo flags s)
 #if defined (MIN_VERSION_ghc_lib_parser)
 #  if !MIN_VERSION_ghc_lib_parser(1,  0,  0) || MIN_VERSION_ghc_lib_parser(8, 10, 0)
   , testCase "ImportQualifiedPost" $ do
@@ -393,7 +414,7 @@
   ]
   where
     flags = defaultDynFlags fakeSettings fakeLlvmConfig
-#if defined(GHCLIB_API_HEAD)
+#if defined (GHCLIB_API_HEAD) || defined (GHCLIB_API_902)
     report flags msgs = concat [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLoc msgs ]
 #else
     report flags msgs = concat [ showSDoc flags msg | msg <- pprErrMsgBagWithLoc msgs ]
