diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-12-05 03:06:40 +0300 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-21 14:50:01 -0400 |
commit | 19e80b9af252eee760dc047765a9930ef00067ec (patch) | |
tree | cb45fce4b1e74e1a82c5bd926fda0e92de1964c1 /compiler/GHC/ThToHs.hs | |
parent | 58235d46bd4e9fbf69bd82969b29cd9c6ab051e1 (diff) | |
download | haskell-19e80b9af252eee760dc047765a9930ef00067ec.tar.gz |
Accumulate Haddock comments in P (#17544, #17561, #8944)
Haddock comments are, first and foremost, comments. It's very annoying
to incorporate them into the grammar. We can take advantage of an
important property: adding a Haddock comment does not change the parse
tree in any way other than wrapping some nodes in HsDocTy and the like
(and if it does, that's a bug).
This patch implements the following:
* Accumulate Haddock comments with their locations in the P monad.
This is handled in the lexer.
* After parsing, do a pass over the AST to associate Haddock comments
with AST nodes using location info.
* Report the leftover comments to the user as a warning (-Winvalid-haddock).
Diffstat (limited to 'compiler/GHC/ThToHs.hs')
-rw-r--r-- | compiler/GHC/ThToHs.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 58add2b135..82ea8b97fe 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -270,7 +270,7 @@ cvtDec (ClassD ctxt cl tvs fds decs) <+> text "are not allowed:") $$ (Outputable.ppr adts')) ; returnJustL $ TyClD noExtField $ - ClassDecl { tcdCExt = noExtField + ClassDecl { tcdCExt = NoLayoutInfo , tcdCtxt = cxt', tcdLName = tc', tcdTyVars = tvs' , tcdFixity = Prefix , tcdFDs = fds', tcdSigs = Hs.mkClassOpSigs sigs' |