diff --git a/CHANGES.markdown b/CHANGES.markdown
--- a/CHANGES.markdown
+++ b/CHANGES.markdown
@@ -1,4 +1,7 @@
-Changes in 0.19
+Changes in 0.18.2
+  - GHC 9.2 compatibility. (#305, thanks to Ryan Scott and Matthew Pickering)
+
+Changes in 0.18.1
   - GHC 9.0 compatibility. (#275)
 
 Changes in 0.18
diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -412,20 +412,42 @@
 ## Contributors
 
  * Adam Vogt
+ * Alan Zimmerman
+ * Alexander Bernauer
+ * Alexandre Esteves
  * Anders Persson
+ * Andreas Abel
  * Ankit Ahuja
+ * Artyom Kazak
  * Edward Kmett
+ * Gabor Greif
  * Hiroki Hattori
+ * Ignat Insarov
+ * Jens Petersen
  * Joachim Breitner
+ * John Chee
  * João Cristóvão
  * Julian Arni
  * Kazu Yamamoto
+ * Leon Schoorl
  * Levent Erkok
  * Luke Murphy
  * Matvey Aksenov
  * Michael Orlitzky
  * Michael Snoyman
+ * Mitchell Rosen
  * Nick Smallbone
+ * Nikos Baxevanis
+ * Oleg Grenrus
+ * quasicomputational
+ * Ryan Scott
  * Sakari Jokinen
  * Simon Hengel
  * Sönke Hahn
+ * Takano Akio
+ * Tamar Christina
+ * Veronika Romashkina
+
+For up-to-date list, query
+
+    git shortlog -s
diff --git a/doctest.cabal b/doctest.cabal
--- a/doctest.cabal
+++ b/doctest.cabal
@@ -1,13 +1,13 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.34.3.
+-- This file has been generated from package.yaml by hpack version 0.34.4.
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: a7c307d4c3548326994e6fb1f8f2e96fd825cb9ba3cf2ed3cc6ea352a2554436
+-- hash: 3c86bef70634c1ec5f684a059a0805713b8f747ef2dcaecf351c5f773410e4d2
 
 name:           doctest
-version:        0.18.1
+version:        0.18.2
 synopsis:       Test interactive Haskell examples
 description:    The doctest program checks examples in source code comments.  It is modeled
                 after doctest for Python (<https://docs.python.org/3/library/doctest.html>).
@@ -20,7 +20,7 @@
 license-file:   LICENSE
 copyright:      (c) 2009-2018 Simon Hengel
 author:         Simon Hengel <sol@typeful.net>
-maintainer:     quasicomputational <quasicomputational@gmail.com>
+maintainer:     quasicomputational@gmail.com, Andreas Abel
 build-type:     Simple
 tested-with:
     GHC == 7.6.3
@@ -31,8 +31,9 @@
   , GHC == 8.4.4
   , GHC == 8.6.5
   , GHC == 8.8.4
-  , GHC == 8.10.4
+  , GHC == 8.10.7
   , GHC == 9.0.1
+  , GHC == 9.2.1
 extra-source-files:
     example/example.cabal
     example/src/Example.hs
@@ -148,7 +149,7 @@
     , directory
     , exceptions
     , filepath
-    , ghc >=7.0 && <9.1
+    , ghc >=7.0 && <9.3
     , ghc-paths >=0.1.0.9
     , process
     , syb >=0.3
@@ -171,7 +172,7 @@
     , doctest
     , exceptions
     , filepath
-    , ghc >=7.0 && <9.1
+    , ghc >=7.0 && <9.3
     , ghc-paths >=0.1.0.9
     , process
     , syb >=0.3
@@ -193,7 +194,7 @@
     , doctest
     , exceptions
     , filepath
-    , ghc >=7.0 && <9.1
+    , ghc >=7.0 && <9.3
     , ghc-paths >=0.1.0.9
     , process
     , syb >=0.3
@@ -250,7 +251,7 @@
     , directory
     , exceptions
     , filepath
-    , ghc >=7.0 && <9.1
+    , ghc >=7.0 && <9.3
     , ghc-paths >=0.1.0.9
     , hspec >=2.3.0
     , hspec-core >=2.3.0
diff --git a/ghci-wrapper/src/Language/Haskell/GhciWrapper.hs b/ghci-wrapper/src/Language/Haskell/GhciWrapper.hs
--- a/ghci-wrapper/src/Language/Haskell/GhciWrapper.hs
+++ b/ghci-wrapper/src/Language/Haskell/GhciWrapper.hs
@@ -15,7 +15,7 @@
 import           System.Exit
 import           Control.Monad
 import           Control.Exception
-import           Data.List
+import           Data.List (isSuffixOf)
 import           Data.Maybe
 
 data Config = Config {
diff --git a/src/Extract.hs b/src/Extract.hs
--- a/src/Extract.hs
+++ b/src/Extract.hs
@@ -66,6 +66,10 @@
 #endif
 #endif
 
+#if __GLASGOW_HASKELL__ >= 901
+import           GHC.Unit.Module.Graph
+#endif
+
 -- | A wrapper around `SomeException`, to allow for a custom `Show` instance.
 newtype ExtractError = ExtractError SomeException
   deriving Typeable
@@ -100,12 +104,6 @@
 
 #if __GLASGOW_HASKELL__ < 803
 type GhcPs = RdrName
-
-needsTemplateHaskellOrQQ :: ModuleGraph -> Bool
-needsTemplateHaskellOrQQ = needsTemplateHaskell
-
-mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph
-mapMG = map
 #endif
 
 #if __GLASGOW_HASKELL__ < 805
@@ -114,36 +112,26 @@
 #endif
 
 -- | Parse a list of modules.
-parse :: [String] -> IO [TypecheckedModule]
+parse :: [String] -> IO [ParsedModule]
 parse args = withGhc args $ \modules_ -> withTempOutputDir $ do
 
   -- ignore additional object files
   let modules = filter (not . isSuffixOf ".o") modules_
 
-  mapM (`guessTarget` Nothing) modules >>= setTargets
+  setTargets =<< forM modules (\ m -> guessTarget m
+#if __GLASGOW_HASKELL__ >= 903
+                Nothing
+#endif
+                Nothing)
   mods <- depanal [] False
 
-  mods' <- if needsTemplateHaskellOrQQ mods then enableCompilation mods else return mods
-
-  let sortedMods = flattenSCCs (topSortModuleGraph False mods' Nothing)
-  reverse <$> mapM (loadModPlugins >=> parseModule >=> typecheckModule >=> loadModule) sortedMods
-  where
-    -- copied from Haddock/Interface.hs
-    enableCompilation :: ModuleGraph -> Ghc ModuleGraph
-    enableCompilation modGraph = do
-#if __GLASGOW_HASKELL__ < 707
-      let enableComp d = d { hscTarget = defaultObjectTarget }
-#elif __GLASGOW_HASKELL__ < 809
-      let enableComp d = let platform = targetPlatform d
-                         in d { hscTarget = defaultObjectTarget platform }
-#else
-      let enableComp d = d { hscTarget = defaultObjectTarget d }
+  let sortedMods = flattenSCCs
+#if __GLASGOW_HASKELL__ >= 901
+                     $ filterToposortToModules
 #endif
-      modifySessionDynFlags enableComp
-      -- We need to update the DynFlags of the ModSummaries as well.
-      let upd m = m { ms_hspp_opts = enableComp (ms_hspp_opts m) }
-      let modGraph' = mapMG upd modGraph
-      return modGraph'
+                     $ topSortModuleGraph False mods Nothing
+  reverse <$> mapM (loadModPlugins >=> parseModule) sortedMods
+  where
 
     -- copied from Haddock/GhcUtils.hs
     modifySessionDynFlags :: (DynFlags -> DynFlags) -> Ghc ()
@@ -190,9 +178,21 @@
 #if __GLASGOW_HASKELL__ >= 806
     -- Since GHC 8.6, plugins are initialized on a per module basis
     loadModPlugins modsum = do
+      _ <- setSessionDynFlags (GHC.ms_hspp_opts modsum)
       hsc_env <- getSession
+
+# if __GLASGOW_HASKELL__ >= 903
+      hsc_env' <- liftIO (initializePlugins hsc_env Nothing)
+      setSession hsc_env'
+      return $ modsum
+# elif __GLASGOW_HASKELL__ >= 901
+      hsc_env' <- liftIO (initializePlugins hsc_env)
+      setSession hsc_env'
+      return $ modsum
+# else
       dynflags' <- liftIO (initializePlugins hsc_env (GHC.ms_hspp_opts modsum))
       return $ modsum { ms_hspp_opts = dynflags' }
+# endif
 #else
     loadModPlugins = return
 #endif
@@ -206,7 +206,7 @@
   packageDBArgs <- getPackageDBArgs
   let args'  = args ++ packageDBArgs
   mods <- parse args'
-  let docs = map (fmap (fmap convertDosLineEndings) . extractFromModule . tm_parsed_module) mods
+  let docs = map (fmap (fmap convertDosLineEndings) . extractFromModule) mods
 
   (docs `deepseq` return docs) `catches` [
       -- Re-throw AsyncException, otherwise execution will not terminate on
@@ -238,13 +238,15 @@
     -- traversing the whole source in a generic way, to ensure that we get
     -- everything in source order.
     header  = [(Nothing, x) | Just x <- [hsmodHaddockModHeader source]]
+    exports = [ (Nothing, L (locA loc) doc)
 #if __GLASGOW_HASKELL__ < 710
-    exports = [(Nothing, L loc doc) | L loc (IEDoc doc) <- concat (hsmodExports source)]
+              | L loc (IEDoc doc) <- concat (hsmodExports source)
 #elif __GLASGOW_HASKELL__ < 805
-    exports = [(Nothing, L loc doc) | L loc (IEDoc doc) <- maybe [] unLoc (hsmodExports source)]
+              | L loc (IEDoc doc) <- maybe [] unLoc (hsmodExports source)
 #else
-    exports = [(Nothing, L loc doc) | L loc (IEDoc _ doc) <- maybe [] unLoc (hsmodExports source)]
+              | L loc (IEDoc _ doc) <- maybe [] unLoc (hsmodExports source)
 #endif
+              ]
     decls   = extractDocStrings (hsmodDecls source)
 
 type Selector a = a -> ([(Maybe String, LHsDocString)], Bool)
@@ -298,15 +300,21 @@
       -- no location information attached.  The location information is
       -- attached to HsDecl instead.
 #if __GLASGOW_HASKELL__ < 805
-      DocD x -> select (fromDocDecl loc x)
+      DocD x
 #else
-      DocD _ x -> select (fromDocDecl loc x)
+      DocD _ x
 #endif
+               -> select (fromDocDecl (locA loc) x)
 
       _ -> (extractDocStrings decl, True)
 
-    fromLDocDecl :: Selector LDocDecl
-    fromLDocDecl (L loc x) = select (fromDocDecl loc x)
+    fromLDocDecl :: Selector
+#if __GLASGOW_HASKELL__ >= 901
+                             (LDocDecl GhcPs)
+#else
+                             LDocDecl
+#endif
+    fromLDocDecl (L loc x) = select (fromDocDecl (locA loc) x)
 
     fromLHsDocString :: Selector LHsDocString
     fromLHsDocString x = select (Nothing, x)
@@ -320,4 +328,9 @@
 -- | Convert a docstring to a plain string.
 unpackHDS :: HsDocString -> String
 unpackHDS (HsDocString s) = unpackFS s
+#endif
+
+#if __GLASGOW_HASKELL__ < 901
+locA :: SrcSpan -> SrcSpan
+locA = id
 #endif
diff --git a/src/GhcUtil.hs b/src/GhcUtil.hs
--- a/src/GhcUtil.hs
+++ b/src/GhcUtil.hs
@@ -80,7 +80,13 @@
 
 handleDynamicFlags :: GhcMonad m => [Located String] -> m [String]
 handleDynamicFlags flags = do
-  (dynflags, locSrcs, _) <- (setHaddockMode `fmap` getSessionDynFlags) >>= flip parseDynamicFlags flags
+#if __GLASGOW_HASKELL__ >= 901
+  logger <- getLogger
+  let parseDynamicFlags' = parseDynamicFlags logger
+#else
+  let parseDynamicFlags' = parseDynamicFlags
+#endif
+  (dynflags, locSrcs, _) <- (setHaddockMode `fmap` getSessionDynFlags) >>= (`parseDynamicFlags'` flags)
   _ <- setSessionDynFlags dynflags
 
   -- We basically do the same thing as `ghc/Main.hs` to distinguish
@@ -97,7 +103,11 @@
 #else
 setHaddockMode dynflags = (gopt_set dynflags Opt_Haddock) {
 #endif
+#if __GLASGOW_HASKELL__ >= 901
+      backend   = NoBackend
+#else
       hscTarget = HscNothing
+#endif
     , ghcMode   = CompManager
     , ghcLink   = NoLink
     }
diff --git a/src/Options.hs b/src/Options.hs
--- a/src/Options.hs
+++ b/src/Options.hs
@@ -22,7 +22,7 @@
 import qualified Control.Monad.Trans.RWS as RWS
 
 import           Control.Monad (when)
-import           Data.List.Compat
+import           Data.List.Compat (intercalate, stripPrefix)
 import           Data.Monoid (Endo (Endo))
 
 import qualified Paths_doctest
diff --git a/src/Parse.hs b/src/Parse.hs
--- a/src/Parse.hs
+++ b/src/Parse.hs
@@ -18,7 +18,7 @@
 ) where
 
 import           Data.Char (isSpace)
-import           Data.List
+import           Data.List (isPrefixOf, stripPrefix)
 import           Data.Maybe
 import           Data.String
 #if __GLASGOW_HASKELL__ < 710
diff --git a/src/Runner/Example.hs b/src/Runner/Example.hs
--- a/src/Runner/Example.hs
+++ b/src/Runner/Example.hs
@@ -4,7 +4,7 @@
 ) where
 
 import           Data.Char
-import           Data.List
+import           Data.List (isPrefixOf)
 import           Util
 
 import           Parse
diff --git a/test/RunSpec.hs b/test/RunSpec.hs
--- a/test/RunSpec.hs
+++ b/test/RunSpec.hs
@@ -9,7 +9,7 @@
 
 import qualified Control.Exception as E
 import           System.Directory (getCurrentDirectory, setCurrentDirectory)
-import           Data.List.Compat
+import           Data.List.Compat (isPrefixOf, sort)
 
 import           System.IO.Silently
 import           System.IO (stderr)
