summaryrefslogtreecommitdiff
path: root/compiler/iface
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2016-11-08 21:37:48 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2016-12-07 21:31:13 +0200
commit499e43824bda967546ebf95ee33ec1f84a114a7c (patch)
tree58b313d734cfba014395ea5876db48e8400296a8 /compiler/iface
parent83d69dca896c7df1f2a36268d5b45c9283985ebf (diff)
downloadhaskell-499e43824bda967546ebf95ee33ec1f84a114a7c.tar.gz
Add HsSyn prettyprinter tests
Summary: Add prettyprinter tests, which take a file, parse it, pretty print it, re-parse the pretty printed version and then compare the original and new ASTs (ignoring locations) Updates haddock submodule to match the AST changes. There are three issues outstanding 1. Extra parens around a context are not reproduced. This will require an AST change and will be done in a separate patch. 2. Currently if an `HsTickPragma` is found, this is not pretty-printed, to prevent noise in the output. I am not sure what the desired behaviour in this case is, so have left it as before. Test Ppr047 is marked as expected fail for this. 3. Apart from in a context, the ParsedSource AST keeps all the parens from the original source. Something is happening in the renamer to remove the parens around visible type application, causing T12530 to fail, as the dumped splice decl is after the renamer. This needs to be fixed by keeping the parens, but I do not know where they are being removed. I have amended the test to pass, by removing the parens in the expected output. Test Plan: ./validate Reviewers: goldfire, mpickering, simonpj, bgamari, austin Reviewed By: simonpj, bgamari Subscribers: simonpj, goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2752 GHC Trac Issues: #3384
Diffstat (limited to 'compiler/iface')
-rw-r--r--compiler/iface/BuildTyCl.hs2
-rw-r--r--compiler/iface/LoadIface.hs3
-rw-r--r--compiler/iface/TcIface.hs2
3 files changed, 4 insertions, 3 deletions
diff --git a/compiler/iface/BuildTyCl.hs b/compiler/iface/BuildTyCl.hs
index 0337abcefc..b291bc53fd 100644
--- a/compiler/iface/BuildTyCl.hs
+++ b/compiler/iface/BuildTyCl.hs
@@ -390,7 +390,7 @@ buildClass tycon_name binders roles sc_theta
; traceIf (text "buildClass" <+> ppr tycon)
; return result }
where
- no_bang = HsSrcBang Nothing NoSrcUnpack NoSrcStrict
+ no_bang = HsSrcBang NoSourceText NoSrcUnpack NoSrcStrict
mk_op_item :: Class -> TcMethInfo -> TcRnIf n m ClassOpItem
mk_op_item rec_clas (op_name, _, dm_spec)
diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs
index 48bc316d0a..921943afb9 100644
--- a/compiler/iface/LoadIface.hs
+++ b/compiler/iface/LoadIface.hs
@@ -923,7 +923,8 @@ ghcPrimIface
mi_fix_fn = mkIfaceFixCache fixities
}
where
- fixities = (getOccName seqId, Fixity "0" 0 InfixR) -- seq is infixr 0
+ fixities = (getOccName seqId, Fixity NoSourceText 0 InfixR)
+ -- seq is infixr 0
: (occName funTyConName, funTyFixity) -- trac #10145
: mapMaybe mkFixity allThePrimOps
mkFixity op = (,) (primOpOcc op) <$> primOpFixity op
diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs
index 6baffedc67..123b02fc81 100644
--- a/compiler/iface/TcIface.hs
+++ b/compiler/iface/TcIface.hs
@@ -803,7 +803,7 @@ tcIfaceDataCons tycon_name tycon tc_tybinders if_cons
; return (HsUnpack (Just co)) }
src_strict :: IfaceSrcBang -> HsSrcBang
- src_strict (IfSrcBang unpk bang) = HsSrcBang Nothing unpk bang
+ src_strict (IfSrcBang unpk bang) = HsSrcBang NoSourceText unpk bang
tcIfaceEqSpec :: IfaceEqSpec -> IfL [EqSpec]
tcIfaceEqSpec spec