summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-02-19 17:06:59 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-20 21:56:21 -0500
commit33fa8d9433d82b03f3209698bf27420a32302321 (patch)
treea9a655bca0d40012fea8581173c94a6fa4e51840 /testsuite
parent581753790da8d094ce05b3fc5f5360f5fbf6a7da (diff)
downloadhaskell-33fa8d9433d82b03f3209698bf27420a32302321.tar.gz
Generalize liftData to work over any Quote (#17857)
The Overloaded Quotations proposal generalized the type of `lift` to work over any `Quote`, but not the type of `liftData`, leading to #17857. Thankfully, generalizing `liftData` is extremely straightforward. Fixes #17857.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/quotes/T17857.hs10
-rw-r--r--testsuite/tests/quotes/all.T1
-rw-r--r--testsuite/tests/th/T10796b.stderr8
3 files changed, 17 insertions, 2 deletions
diff --git a/testsuite/tests/quotes/T17857.hs b/testsuite/tests/quotes/T17857.hs
new file mode 100644
index 0000000000..f64f0ce753
--- /dev/null
+++ b/testsuite/tests/quotes/T17857.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+module T17857 where
+
+import Data.Data
+import Language.Haskell.TH.Syntax
+
+data T = MkT deriving Data
+instance Lift T where
+ lift = liftData
+ liftTyped = unsafeTExpCoerce . lift
diff --git a/testsuite/tests/quotes/all.T b/testsuite/tests/quotes/all.T
index 46f53bce6a..1a5d5242b4 100644
--- a/testsuite/tests/quotes/all.T
+++ b/testsuite/tests/quotes/all.T
@@ -16,6 +16,7 @@ test('T8759a', normal, compile, ['-v0'])
test('T9824', normal, compile, ['-v0'])
test('T10384', normal, compile_fail, [''])
test('T16384', req_th, compile, [''])
+test('T17857', normal, compile, [''])
test('TH_tf2', normal, compile, ['-v0'])
test('TH_ppr1', normal, compile_and_run, [''])
diff --git a/testsuite/tests/th/T10796b.stderr b/testsuite/tests/th/T10796b.stderr
index 7c7b89171b..84a03ddc86 100644
--- a/testsuite/tests/th/T10796b.stderr
+++ b/testsuite/tests/th/T10796b.stderr
@@ -1,5 +1,9 @@
-T10796b.hs:8:16: error:
- • Can't construct a pattern from name Data.Set.Internal.fromList
+T10796b.hs:8:15: error:
+ • Exception when trying to run compile-time code:
+ Can't construct a pattern from name Data.Set.Internal.fromList
+CallStack (from HasCallStack):
+ error, called at libraries/template-haskell/Language/Haskell/TH/Syntax.hs:1203:22 in template-haskell:Language.Haskell.TH.Syntax
+ Code: (dataToPatQ (const Nothing) (fromList "test"))
• In the untyped splice:
$(dataToPatQ (const Nothing) (fromList "test"))