[commit: ghc] master: Refactor the handling of quasi-quotes (f46360e)
git at git.haskell.org
git at git.haskell.org
Tue Feb 10 14:50:47 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f46360ed7139ff25741b381647b0a0b6d1000d84/ghc
>---------------------------------------------------------------
commit f46360ed7139ff25741b381647b0a0b6d1000d84
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Feb 10 14:09:12 2015 +0000
Refactor the handling of quasi-quotes
As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed
to behave exactly like $(n "...blah..."). But it doesn't! This was outright
wrong: quasiquotes were being run even inside brackets.
Now that TH supports both typed and untyped splices, a quasi-quote is properly
regarded as a particular syntax for an untyped splice. But apart from that
they should be treated the same. So this patch refactors the handling of
quasiquotes to do just that.
The changes touch quite a lot of files, but mostly in a routine way.
The biggest changes by far are in RnSplice, and more minor changes in
TcSplice. These are the places where there was real work to be done.
Everything else is routine knock-on changes.
* No more QuasiQuote forms in declarations, expressions, types, etc.
So we get rid of these data constructors
* HsBinds.QuasiQuoteD
* HsExpr.HsSpliceE
* HsPat.QuasiQuotePat
* HsType.HsQuasiQuoteTy
* We get rid of the HsQuasiQuote type altogether
* Instead, we augment the HsExpr.HsSplice type to have three
consructors, for the three types of splice:
* HsTypedSplice
* HsUntypedSplice
* HsQuasiQuote
There are some related changes in the data types in HsExpr near HsSplice.
Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour.
* In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one.
A smaller, clearer interface.
* We have to update the Haddock submodule, to accommodate the hsSyn changes
>---------------------------------------------------------------
f46360ed7139ff25741b381647b0a0b6d1000d84
compiler/deSugar/Check.hs | 2 -
compiler/deSugar/DsArrows.hs | 1 -
compiler/deSugar/DsExpr.hs | 3 +-
compiler/deSugar/DsMeta.hs | 15 +-
compiler/hsSyn/HsDecls.hs | 8 +-
compiler/hsSyn/HsExpr.hs | 122 ++++---
compiler/hsSyn/HsExpr.hs-boot | 3 +-
compiler/hsSyn/HsPat.hs | 13 +-
compiler/hsSyn/HsTypes.hs | 35 +-
compiler/hsSyn/HsUtils.hs | 19 +-
compiler/main/Hooks.hs | 7 +-
compiler/parser/Parser.y | 6 +-
compiler/parser/RdrHsSyn.hs | 15 +-
compiler/rename/RnExpr.hs | 11 +-
compiler/rename/RnPat.hs | 9 +-
compiler/rename/RnSource.hs | 5 -
compiler/rename/RnSplice.hs | 400 +++++++++++++--------
compiler/rename/RnTypes.hs | 9 -
compiler/typecheck/TcEnv.hs | 2 +-
compiler/typecheck/TcExpr.hs | 7 +-
compiler/typecheck/TcHsSyn.hs | 8 +-
compiler/typecheck/TcHsType.hs | 1 -
compiler/typecheck/TcPat.hs | 3 -
compiler/typecheck/TcPatSyn.hs | 2 -
compiler/typecheck/TcRnDriver.hs | 13 +-
compiler/typecheck/TcSplice.hs | 252 ++-----------
compiler/typecheck/TcSplice.hs-boot | 33 +-
.../tests/annotations/should_fail/annfail03.stderr | 2 +-
.../tests/annotations/should_fail/annfail04.stderr | 2 +-
.../tests/annotations/should_fail/annfail06.stderr | 2 +-
.../tests/annotations/should_fail/annfail09.stderr | 2 +-
testsuite/tests/quasiquotation/T3953.stderr | 4 +-
testsuite/tests/quasiquotation/qq001/qq001.stderr | 6 +-
testsuite/tests/quasiquotation/qq002/qq002.stderr | 6 +-
testsuite/tests/quasiquotation/qq003/qq003.stderr | 6 +-
testsuite/tests/quasiquotation/qq004/qq004.stderr | 6 +-
testsuite/tests/th/T10047.hs | 6 +
testsuite/tests/th/T10047.script | 4 +
testsuite/tests/th/T10047.stdout | 2 +
testsuite/tests/th/T2597b.stderr | 2 +-
testsuite/tests/th/T3177a.stderr | 2 +-
testsuite/tests/th/T3395.stderr | 2 +-
testsuite/tests/th/T5358.stderr | 4 +-
testsuite/tests/th/T5795.stderr | 4 +-
testsuite/tests/th/T5971.stderr | 2 +-
testsuite/tests/th/T7276.stderr | 4 +-
testsuite/tests/th/T7276a.stdout | 2 +-
testsuite/tests/th/T7667a.stderr | 2 +-
testsuite/tests/th/T8412.stderr | 2 +-
testsuite/tests/th/TH_1tuple.stderr | 2 +-
testsuite/tests/th/TH_StaticPointers02.stderr | 6 +-
testsuite/tests/th/TH_runIO.stderr | 4 +-
testsuite/tests/th/TH_unresolvedInfix2.stderr | 6 +-
testsuite/tests/th/all.T | 1 +
utils/haddock | 2 +-
55 files changed, 472 insertions(+), 627 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f46360ed7139ff25741b381647b0a0b6d1000d84
More information about the ghc-commits
mailing list