[commit: ghc] wip/rae: Test that nested pattern splices don't scope (#1476). (87af99c)
git at git.haskell.org
git at git.haskell.org
Tue Nov 4 18:58:36 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rae
Link : http://ghc.haskell.org/trac/ghc/changeset/87af99c6f96b0950145e2a37da6406bd93cbbcef/ghc
>---------------------------------------------------------------
commit 87af99c6f96b0950145e2a37da6406bd93cbbcef
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Tue Nov 4 13:06:56 2014 -0500
Test that nested pattern splices don't scope (#1476).
Test case: th/T1476b.
>---------------------------------------------------------------
87af99c6f96b0950145e2a37da6406bd93cbbcef
testsuite/tests/th/T1476b.hs | 10 ++++++++++
testsuite/tests/th/T1476b.stderr | 5 +++++
testsuite/tests/th/all.T | 1 +
3 files changed, 16 insertions(+)
diff --git a/testsuite/tests/th/T1476b.hs b/testsuite/tests/th/T1476b.hs
new file mode 100644
index 0000000..918a397
--- /dev/null
+++ b/testsuite/tests/th/T1476b.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T1476b where
+
+import Language.Haskell.TH
+
+baz = [| \ $( return $ VarP $ mkName "x" ) -> x |]
+
+-- If this test starts passing, nested pattern splices scope correctly.
+-- Good for you! Now, update the TH manual accordingly.
diff --git a/testsuite/tests/th/T1476b.stderr b/testsuite/tests/th/T1476b.stderr
new file mode 100644
index 0000000..65b0814
--- /dev/null
+++ b/testsuite/tests/th/T1476b.stderr
@@ -0,0 +1,5 @@
+
+T1476b.hs:7:47:
+ Not in scope: ‘x’
+ In the Template Haskell quotation
+ [| \ $(return $ VarP $ mkName "x") -> x |]
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 72c1a75..0e0d500 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -340,3 +340,4 @@ test('T9066', normal, compile, ['-v0'])
test('T9209', normal, compile_fail, ['-v0'])
test('T7484', normal, compile_fail, ['-v0'])
test('T1476', expect_broken(1476), compile, ['-v0'])
+test('T1476b', normal, compile_fail, ['-v0'])
More information about the ghc-commits
mailing list