summaryrefslogtreecommitdiff
path: root/testsuite/tests/th
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2022-01-17 15:43:11 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-16 02:28:24 -0400
commita33d10452c261ab39ce8c0954bac9053c212a6cc (patch)
tree9844ab433b4400a1466c5e8edd5a929e0a70203f /testsuite/tests/th
parentc1fed9da095303591c37c53bad5f5559381048d7 (diff)
downloadhaskell-a33d10452c261ab39ce8c0954bac9053c212a6cc.tar.gz
TH: allow negative patterns in quotes (#20711)
We still don't allow negative overloaded patterns. Earler all negative patterns were treated as negative overloaded patterns. Now, we expliclty check the extension field to see if the pattern is actually a negative overloaded pattern
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r--testsuite/tests/th/T20711.hs11
-rw-r--r--testsuite/tests/th/T20711.stdout2
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/th/T20711.hs b/testsuite/tests/th/T20711.hs
new file mode 100644
index 0000000000..f18b672ab5
--- /dev/null
+++ b/testsuite/tests/th/T20711.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import Language.Haskell.TH
+
+main :: IO ()
+main = do
+ x <- [d| f (-1) = () |]
+ putStrLn $ pprint x
+ y <- [d| f (-10) = () |]
+ putStrLn $ pprint y
diff --git a/testsuite/tests/th/T20711.stdout b/testsuite/tests/th/T20711.stdout
new file mode 100644
index 0000000000..f14e7b3479
--- /dev/null
+++ b/testsuite/tests/th/T20711.stdout
@@ -0,0 +1,2 @@
+f_0 (-1) = GHC.Tuple.()
+f_0 (-10) = GHC.Tuple.()
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 165ef6a7e2..01a64a3848 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -548,3 +548,4 @@ test('T21038', normal, compile, [''])
test('T20842', normal, compile_and_run, [''])
test('T15433a', [extra_files(['T15433_aux.hs'])], multimod_compile_fail, ['T15433a', '-v0'])
test('T15433b', [extra_files(['T15433_aux.hs'])], multimod_compile, ['T15433b', '-v0'])
+test('T20711', normal, compile_and_run, [''])