[commit: ghc] wip/rae: Test that nested pattern splices don't scope (#1476). (419c5de)

git at git.haskell.org git at git.haskell.org
Thu Nov 20 21:54:40 UTC 2014


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

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/419c5de91e503457fb88cb6c175f21b9325032e0/ghc

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

commit 419c5de91e503457fb88cb6c175f21b9325032e0
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.


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

419c5de91e503457fb88cb6c175f21b9325032e0
 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