Update doctest-0.20.0 patch to accommodate "hi haddock: Lex and store haddock docs in interface files"
After commit ghc@b91798be (hi haddock: Lex and store haddock docs in interface files
), the doctest-0.20.0
patch no longer compiles. Here is an example of the error message from a recent build-master
CI job:
[10 of 16] Compiling Extract ( src/Extract.hs, dist/build/Extract.o, dist/build/Extract.dyn_o )
src/Extract.hs:226:56: error:
Variable not in scope: unpackHDS :: HsDoc GhcPs -> String
Suggested fix: Perhaps use ‘unpackHDSC’ (imported from GHC)
|
226 | docStringsFromModule mod = map (fmap (toLocated . fmap unpackHDS)) docs
| ^^^^^^^^^
src/Extract.hs:231:26: error:
• Couldn't match type: GenLocated SrcSpan (HsDoc GhcPs)
with: WithHsDocIdentifiers HsDocString GhcPs
Expected: [(Maybe String, LHsDoc GhcPs)]
Actual: [(Maybe String, GenLocated SrcSpan (LHsDoc GhcPs))]
• In the first argument of ‘(++)’, namely ‘exports’
In the second argument of ‘(++)’, namely ‘exports ++ decls’
In the expression: header ++ exports ++ decls
|
231 | docs = header ++ exports ++ decls
| ^^^^^^^
src/Extract.hs:231:37: error:
• Couldn't match type ‘HsDocString’
with ‘WithHsDocIdentifiers HsDocString GhcPs’
Expected: [(Maybe String, LHsDoc GhcPs)]
Actual: [(Maybe String, LHsDocString)]
• In the second argument of ‘(++)’, namely ‘decls’
In the second argument of ‘(++)’, namely ‘exports ++ decls’
In the expression: header ++ exports ++ decls
|
231 | docs = header ++ exports ++ decls
| ^^^^^
src/Extract.hs:318:31: error:
• Expecting one more argument to ‘DocDecl’
Expected a type, but ‘DocDecl’ has kind ‘* -> *’
• In the type signature:
fromDocDecl :: SrcSpan -> DocDecl -> (Maybe String, LHsDocString)
In an equation for ‘extractDocStrings’:
extractDocStrings
= everythingBut
(++)
(([], False) `mkQ` fromLHsDecl `extQ` fromLDocDecl
`extQ` fromLHsDocString)
where
fromLHsDecl :: Selector (LHsDecl GhcPs)
fromLHsDecl (L loc decl)
= case decl of
DocD _ x -> select (fromDocDecl (locA loc) x)
_ -> ...
fromLDocDecl :: Selector (LDocDecl GhcPs)
fromLDocDecl (L loc x) = select (fromDocDecl (locA loc) x)
....
|
318 | fromDocDecl :: SrcSpan -> DocDecl -> (Maybe String, LHsDocString)
| ^^^^^^^
The API changed pretty substantially in that commit, so it may take a bit of work to update the doctest-0.20.0
patch accordingly. Depending on how involved the changes are, we may want to consider adding doctest
to the list of expected failures in the meantime.