Test that nested pattern splices don't scope (#1476).
authorRichard Eisenberg <eir@cis.upenn.edu>
Tue, 4 Nov 2014 18:06:56 +0000 (13:06 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Fri, 21 Nov 2014 16:15:47 +0000 (11:15 -0500)
Test case: th/T1476b.

testsuite/tests/th/T1476b.hs [new file with mode: 0644]
testsuite/tests/th/T1476b.stderr [new file with mode: 0644]
testsuite/tests/th/all.T

diff --git a/testsuite/tests/th/T1476b.hs b/testsuite/tests/th/T1476b.hs
new file mode 100644 (file)
index 0000000..918a397
--- /dev/null
@@ -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 (file)
index 0000000..65b0814
--- /dev/null
@@ -0,0 +1,5 @@
+
+T1476b.hs:7:47:
+    Not in scope: ‘x’
+    In the Template Haskell quotation
+      [| \ $(return $ VarP $ mkName "x") -> x |]
index 27cde1b..3f8ff16 100644 (file)
@@ -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'])