diff options
author | Michael Smith <michael@diglumi.com> | 2015-09-02 13:57:44 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-09-02 13:58:59 +0200 |
commit | c8f623e305ec0a51ac2406a1f754d244e05b96f5 (patch) | |
tree | 5486d652fa38985657e8916ba176149644ed74a9 /testsuite/tests/quasiquotation | |
parent | ba5554ec2753cc41f5e087a91f23e1f612a9eb29 (diff) | |
download | haskell-c8f623e305ec0a51ac2406a1f754d244e05b96f5.tar.gz |
Expand declaration QQs first (#10047)
Declaration QuasiQuoters do not cause a group split like $(...)
splices, and are run and expanded before other declarations in
the group.
Resolves the lingering issue with #10047, and fixes broken tests
qq007 and qq008.
Test Plan: validate
Reviewers: goldfire, austin, bgamari
Reviewed By: bgamari
Subscribers: goldfire, simonpj, thomie, spinda
Differential Revision: https://phabricator.haskell.org/D1199
GHC Trac Issues: #10047
Diffstat (limited to 'testsuite/tests/quasiquotation')
-rw-r--r-- | testsuite/tests/quasiquotation/qq007/test.T | 1 | ||||
-rw-r--r-- | testsuite/tests/quasiquotation/qq008/test.T | 1 | ||||
-rw-r--r-- | testsuite/tests/quasiquotation/qq009/Makefile | 11 | ||||
-rw-r--r-- | testsuite/tests/quasiquotation/qq009/QQ.hs | 14 | ||||
-rw-r--r-- | testsuite/tests/quasiquotation/qq009/Test.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/quasiquotation/qq009/test.T | 7 |
6 files changed, 41 insertions, 2 deletions
diff --git a/testsuite/tests/quasiquotation/qq007/test.T b/testsuite/tests/quasiquotation/qq007/test.T index d9a2df31d3..0b4448cdc0 100644 --- a/testsuite/tests/quasiquotation/qq007/test.T +++ b/testsuite/tests/quasiquotation/qq007/test.T @@ -2,7 +2,6 @@ test('qq007', [when(fast(), skip), extra_clean(['QQ.hi', 'QQ.o', 'Test.hi', 'Test.o']), pre_cmd('$MAKE -s --no-print-directory TH_QQ'), - expect_broken(10047), ], multimod_compile, ['Test', '-v0']) diff --git a/testsuite/tests/quasiquotation/qq008/test.T b/testsuite/tests/quasiquotation/qq008/test.T index 5bdd2a9822..8cac1a9f0a 100644 --- a/testsuite/tests/quasiquotation/qq008/test.T +++ b/testsuite/tests/quasiquotation/qq008/test.T @@ -2,7 +2,6 @@ test('qq008', [when(fast(), skip), extra_clean(['QQ.hi', 'QQ.o', 'Test.hi', 'Test.o']), pre_cmd('$MAKE -s --no-print-directory TH_QQ'), - expect_broken(10047), ], multimod_compile, ['Test', '-v0']) diff --git a/testsuite/tests/quasiquotation/qq009/Makefile b/testsuite/tests/quasiquotation/qq009/Makefile new file mode 100644 index 0000000000..0fa91dbf9a --- /dev/null +++ b/testsuite/tests/quasiquotation/qq009/Makefile @@ -0,0 +1,11 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +.PHONY: TH_QQ +TH_QQ: +ifeq "$(GhcDynamic)" "YES" + '$(TEST_HC)' $(TEST_HC_OPTS) -c QQ.hs -dynamic -osuf dyn_o -hisuf dyn_hi +else + '$(TEST_HC)' $(TEST_HC_OPTS) -c QQ.hs +endif diff --git a/testsuite/tests/quasiquotation/qq009/QQ.hs b/testsuite/tests/quasiquotation/qq009/QQ.hs new file mode 100644 index 0000000000..89350bac60 --- /dev/null +++ b/testsuite/tests/quasiquotation/qq009/QQ.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} +module QQ where + +import Language.Haskell.TH.Quote +import Language.Haskell.TH.Syntax +import Language.Haskell.TH + +pq = QuasiQuoter { quoteDec = \_ -> return [sig], + quoteType = \_ -> undefined, + quoteExp = \_ -> undefined, + quotePat = \_ -> undefined } + +sig = SigD (mkName "f") (ArrowT `AppT` int `AppT` int) +int = ConT (mkName "Int") diff --git a/testsuite/tests/quasiquotation/qq009/Test.hs b/testsuite/tests/quasiquotation/qq009/Test.hs new file mode 100644 index 0000000000..1b43fb2acf --- /dev/null +++ b/testsuite/tests/quasiquotation/qq009/Test.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE QuasiQuotes #-} +module Test where + +import QQ + +f' = f . (+ 1) + +[pq| foo |] -- Expands to f :: Int -> Int +f x = x + 1 diff --git a/testsuite/tests/quasiquotation/qq009/test.T b/testsuite/tests/quasiquotation/qq009/test.T new file mode 100644 index 0000000000..10b939a3bd --- /dev/null +++ b/testsuite/tests/quasiquotation/qq009/test.T @@ -0,0 +1,7 @@ +test('qq009', + [when(fast(), skip), + extra_clean(['QQ.hi', 'QQ.o', 'Test.hi', 'Test.o']), + pre_cmd('$MAKE -s --no-print-directory TH_QQ'), + ], + multimod_compile, + ['Test', '-v0']) |