[commit: ghc] master: Test that nested pattern splices don't scope (#1476). (d627c5c)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 16:18:36 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d627c5cf81fcce05ec160edc5be907297ff05c33/ghc

>---------------------------------------------------------------

commit d627c5cf81fcce05ec160edc5be907297ff05c33
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.


>---------------------------------------------------------------

d627c5cf81fcce05ec160edc5be907297ff05c33
 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 27cde1b..3f8ff16 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -345,3 +345,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