Add HsSyn prettyprinter tests
authorAlan Zimmerman <alan.zimm@gmail.com>
Tue, 8 Nov 2016 19:37:48 +0000 (21:37 +0200)
committerAlan Zimmerman <alan.zimm@gmail.com>
Wed, 7 Dec 2016 19:31:13 +0000 (21:31 +0200)
commit499e43824bda967546ebf95ee33ec1f84a114a7c
tree58b313d734cfba014395ea5876db48e8400296a8
parent83d69dca896c7df1f2a36268d5b45c9283985ebf
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
261 files changed:
compiler/basicTypes/BasicTypes.hs
compiler/basicTypes/DataCon.hs
compiler/basicTypes/MkId.hs
compiler/basicTypes/Var.hs
compiler/coreSyn/PprCore.hs
compiler/deSugar/Coverage.hs
compiler/deSugar/DsArrows.hs
compiler/deSugar/DsCCall.hs
compiler/deSugar/DsForeign.hs
compiler/deSugar/DsMeta.hs
compiler/deSugar/MatchLit.hs
compiler/hsSyn/Convert.hs
compiler/hsSyn/HsBinds.hs
compiler/hsSyn/HsDecls.hs
compiler/hsSyn/HsExpr.hs
compiler/hsSyn/HsExpr.hs-boot
compiler/hsSyn/HsImpExp.hs
compiler/hsSyn/HsLit.hs
compiler/hsSyn/HsPat.hs
compiler/hsSyn/HsPat.hs-boot
compiler/hsSyn/HsSyn.hs
compiler/hsSyn/HsTypes.hs
compiler/hsSyn/HsUtils.hs
compiler/hsSyn/PlaceHolder.hs
compiler/iface/BuildTyCl.hs
compiler/iface/LoadIface.hs
compiler/iface/TcIface.hs
compiler/main/HeaderInfo.hs
compiler/parser/Lexer.x
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
compiler/prelude/ForeignCall.hs
compiler/prelude/PrimOp.hs
compiler/prelude/TysWiredIn.hs
compiler/rename/RnEnv.hs
compiler/rename/RnExpr.hs
compiler/rename/RnPat.hs
compiler/rename/RnSplice.hs
compiler/rename/RnTypes.hs
compiler/stranal/WorkWrap.hs
compiler/typecheck/Inst.hs
compiler/typecheck/TcAnnotations.hs
compiler/typecheck/TcArrows.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcEnv.hs
compiler/typecheck/TcGenDeriv.hs
compiler/typecheck/TcGenFunctor.hs
compiler/typecheck/TcGenGenerics.hs
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcPatSyn.hs
compiler/typecheck/TcSplice.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcTyDecls.hs
compiler/typecheck/TcTypeable.hs
compiler/utils/Binary.hs
compiler/utils/BooleanFormula.hs
compiler/utils/Outputable.hs
compiler/vectorise/Vectorise/Generic/PData.hs
ghc.mk
testsuite/mk/boilerplate.mk
testsuite/tests/ado/ado002.stderr
testsuite/tests/ado/ado003.stderr
testsuite/tests/ado/ado005.stderr
testsuite/tests/arrows/should_fail/arrowfail004.stderr
testsuite/tests/boxy/Base1.stderr
testsuite/tests/dependent/should_fail/PromotedClass.stderr
testsuite/tests/dependent/should_fail/RAE_T32a.stderr
testsuite/tests/dependent/should_fail/T11334b.stderr
testsuite/tests/ffi/should_fail/T10461.stderr
testsuite/tests/ffi/should_fail/T3066.stderr
testsuite/tests/ffi/should_fail/T7506.stderr
testsuite/tests/ffi/should_fail/capi_value_function.stderr
testsuite/tests/ffi/should_fail/ccfail001.stderr
testsuite/tests/ffi/should_fail/ccfail002.stderr
testsuite/tests/ffi/should_fail/ccfail004.stderr
testsuite/tests/ffi/should_fail/ccfail005.stderr
testsuite/tests/generics/GenDerivOutput.stderr
testsuite/tests/generics/GenDerivOutput1_0.stderr
testsuite/tests/generics/GenDerivOutput1_1.stderr
testsuite/tests/generics/T10604/T10604_deriving.stderr
testsuite/tests/ghc-api/annotations-literals/literals.stdout
testsuite/tests/ghc-api/annotations-literals/parsed.hs
testsuite/tests/ghc-api/annotations-literals/parsed.stdout
testsuite/tests/ghc-api/annotations/T10276.stderr
testsuite/tests/ghc-api/annotations/T10313.stdout
testsuite/tests/ghc-api/annotations/T11430.stdout
testsuite/tests/ghc-api/annotations/t11430.hs
testsuite/tests/ghci/scripts/T8959b.stderr
testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail14.stderr
testsuite/tests/indexed-types/should_fail/T12867.stderr
testsuite/tests/indexed-types/should_fail/T2664.stderr
testsuite/tests/indexed-types/should_fail/T2693.stderr
testsuite/tests/indexed-types/should_fail/T5439.stderr
testsuite/tests/indexed-types/should_fail/T7786.stderr
testsuite/tests/monadfail/MonadFailErrors.stderr
testsuite/tests/monadfail/MonadFailWarnings.stderr
testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr
testsuite/tests/partial-sigs/should_compile/T12845.stderr
testsuite/tests/polykinds/PolyKinds04.stderr
testsuite/tests/polykinds/PolyKinds07.stderr
testsuite/tests/polykinds/T10503.stderr
testsuite/tests/polykinds/T11399.stderr
testsuite/tests/polykinds/T11520.stderr
testsuite/tests/polykinds/T11611.stderr
testsuite/tests/polykinds/T5716.stderr
testsuite/tests/polykinds/T5716a.stderr
testsuite/tests/polykinds/T6054.stderr
testsuite/tests/polykinds/T7151.stderr
testsuite/tests/polykinds/T7328.stderr
testsuite/tests/polykinds/T7433.stderr
testsuite/tests/polykinds/T7805.stderr
testsuite/tests/printer/.gitignore [new file with mode: 0644]
testsuite/tests/printer/Makefile [new file with mode: 0644]
testsuite/tests/printer/Ppr001.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr002.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr003.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr004.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr005.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr006.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr006.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr007.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr007.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr008.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr009.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr009.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr010.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr011.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr011.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr012.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr012.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr012.stdout [new file with mode: 0644]
testsuite/tests/printer/Ppr013.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr013.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr014.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr014.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr015.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr016.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr016.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr017.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr018.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr018.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr019.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr020.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr020.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr021.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr021.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr022.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr022.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr023.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr023.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr024.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr024.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr025.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr025.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr026.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr026.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr027.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr028.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr028.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr029.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr029.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr030.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr030.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr031.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr031.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr032.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr032.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr033.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr033.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr034.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr034.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr035.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr036.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr036.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr037.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr037.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr038.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr039.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr039.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr040.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr040.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr041.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr042.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr042.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr043.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr044.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr045.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr046.hs [new file with mode: 0644]
testsuite/tests/printer/Ppr046.stderr [new file with mode: 0644]
testsuite/tests/printer/Ppr047.hs [new file with mode: 0644]
testsuite/tests/printer/all.T [new file with mode: 0644]
testsuite/tests/quasiquotation/T7918.hs
testsuite/tests/rebindable/rebindable6.stderr
testsuite/tests/rename/should_fail/Misplaced.stderr
testsuite/tests/rename/should_fail/rnfail026.stderr
testsuite/tests/roles/should_compile/T8958.stderr
testsuite/tests/safeHaskell/ghci/p6.stderr
testsuite/tests/safeHaskell/safeLanguage/SafeLang08.stderr
testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr
testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr
testsuite/tests/simplCore/should_compile/T7785.stderr
testsuite/tests/simplCore/should_compile/T8331.stderr
testsuite/tests/simplCore/should_compile/T8848a.stderr
testsuite/tests/simplCore/should_compile/simpl017.stderr
testsuite/tests/th/T10598_TH.stderr
testsuite/tests/th/T10638.stderr
testsuite/tests/th/T12530.stderr
testsuite/tests/th/T3177a.stderr
testsuite/tests/th/T3319.stderr
testsuite/tests/th/T3899a.hs
testsuite/tests/th/T4436.stderr
testsuite/tests/th/T5217.stderr
testsuite/tests/th/T5358.stderr
testsuite/tests/th/T5508.stderr
testsuite/tests/th/T5700.stderr
testsuite/tests/th/T5883.stderr
testsuite/tests/th/T7532.stderr
testsuite/tests/th/T8577.stderr
testsuite/tests/th/T8761.stderr
testsuite/tests/th/TH_PromotedTuple.stderr
testsuite/tests/th/TH_exn2.stderr
testsuite/tests/th/TH_foreignCallingConventions.stderr
testsuite/tests/th/TH_foreignInterruptible.stderr
testsuite/tests/th/TH_pragma.stderr
testsuite/tests/th/TH_unresolvedInfix2.stderr
testsuite/tests/typecheck/should_compile/T11339.stderr
testsuite/tests/typecheck/should_compile/tc211.stderr
testsuite/tests/typecheck/should_fail/T11464.stderr
testsuite/tests/typecheck/should_fail/T12124.stderr
testsuite/tests/typecheck/should_fail/T2994.stderr
testsuite/tests/typecheck/should_fail/T3540.stderr
testsuite/tests/typecheck/should_fail/T3613.stderr
testsuite/tests/typecheck/should_fail/T7748a.stderr
testsuite/tests/typecheck/should_fail/T7851.stderr
testsuite/tests/typecheck/should_fail/T8603.stderr
testsuite/tests/typecheck/should_fail/T9201.stderr
testsuite/tests/typecheck/should_fail/T9612.stderr
testsuite/tests/typecheck/should_fail/tcfail028.stderr
testsuite/tests/typecheck/should_fail/tcfail070.stderr
testsuite/tests/typecheck/should_fail/tcfail103.stderr
testsuite/tests/typecheck/should_fail/tcfail128.stderr
testsuite/tests/typecheck/should_fail/tcfail132.stderr
testsuite/tests/typecheck/should_fail/tcfail146.stderr
testsuite/tests/typecheck/should_fail/tcfail162.stderr
testsuite/tests/typecheck/should_fail/tcfail165.stderr
testsuite/tests/typecheck/should_fail/tcfail168.stderr
testsuite/tests/unboxedsums/ffi1.stderr
testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
utils/check-ppr/Main.hs [new file with mode: 0644]
utils/check-ppr/README [new file with mode: 0644]
utils/check-ppr/check-ppr.cabal [new file with mode: 0644]
utils/check-ppr/ghc.mk [new file with mode: 0644]
utils/genprimopcode/Parser.y
utils/genprimopcode/Syntax.hs
utils/haddock