[commit: ghc] wip/rae: Test that nested pattern splices don't scope (#1476). (52eec0e)
git at git.haskell.org
git at git.haskell.org
Tue Nov 18 20:21:52 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rae
Link : http://ghc.haskell.org/trac/ghc/changeset/52eec0e46091221ff806d6103af5fff3797c0590/ghc
>---------------------------------------------------------------
commit 52eec0e46091221ff806d6103af5fff3797c0590
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.
>---------------------------------------------------------------
52eec0e46091221ff806d6103af5fff3797c0590
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 b23a615..a636986 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -342,3 +342,4 @@ test('T9064', 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