summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-12-05 03:06:40 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2020-07-20 12:10:03 +0300
commit4bda699ce3a3f86486409b3f45f1eb761e3b8265 (patch)
treee06ebbafa831b6af7c806b4ef77234b8bdbf95e8 /compiler/GHC/Tc
parentc26e81d116a653b5259aeb290fb1e697efe3382a (diff)
downloadhaskell-wip/haddock-accum.tar.gz
Accumulate Haddock comments in P (#17544, #17561, #8944)wip/haddock-accum
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/Tc')
-rw-r--r--compiler/GHC/Tc/Module.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 0145c6c776..277a6fec7d 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -206,7 +206,7 @@ tcRnModuleTcRnM :: HscEnv
tcRnModuleTcRnM hsc_env mod_sum
(HsParsedModule {
hpm_module =
- (L loc (HsModule maybe_mod export_ies
+ (L loc (HsModule _ maybe_mod export_ies
import_decls local_decls mod_deprec
maybe_doc_hdr)),
hpm_src_files = src_files