summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-11-22 13:25:17 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-25 01:07:40 -0500
commit4d34bf15e3bebb9f31467278e609f64a3e5b255d (patch)
tree933431e43586562ed4dab6d2fac0ae7acbd89f5b /testsuite
parentd530c46c89acd85a5cb0d1d1dc87fd1960f654b0 (diff)
downloadhaskell-4d34bf15e3bebb9f31467278e609f64a3e5b255d.tar.gz
Don't use implicit lifting when deriving Lift
It isn't much more complicated to be more precise when deriving Lift so we now generate ``` data Foo = Foo Int Bool instance Lift Foo where lift (Foo a b) = [| Foo $(lift a) $(lift b) |] liftTyped (Foo a b) = [|| Foo $$(lift a) $$(lift b) |] ``` This fixes #20688 which complained about using implicit lifting in the derived code.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/deriving/should_compile/T14682.stderr8
-rw-r--r--testsuite/tests/quotes/T20688.hs7
-rw-r--r--testsuite/tests/quotes/all.T1
3 files changed, 14 insertions, 2 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14682.stderr b/testsuite/tests/deriving/should_compile/T14682.stderr
index 1d84be7b50..632af19788 100644
--- a/testsuite/tests/deriving/should_compile/T14682.stderr
+++ b/testsuite/tests/deriving/should_compile/T14682.stderr
@@ -13,11 +13,15 @@ Derived class instances:
instance Language.Haskell.TH.Syntax.Lift T14682.Foo where
Language.Haskell.TH.Syntax.lift (T14682.Foo a1 a2)
- = [| T14682.Foo a1 a2 |]
+ = [| T14682.Foo
+ $(Language.Haskell.TH.Syntax.lift a1)
+ $(Language.Haskell.TH.Syntax.lift a2) |]
pending(rn) [<a2, Language.Haskell.TH.Syntax.lift a2>,
<a1, Language.Haskell.TH.Syntax.lift a1>]
Language.Haskell.TH.Syntax.liftTyped (T14682.Foo a1 a2)
- = [|| T14682.Foo a1 a2 ||]
+ = [|| T14682.Foo
+ $$(Language.Haskell.TH.Syntax.liftTyped a1)
+ $$(Language.Haskell.TH.Syntax.liftTyped a2) ||]
instance Data.Data.Data T14682.Foo where
Data.Data.gfoldl k z (T14682.Foo a1 a2)
diff --git a/testsuite/tests/quotes/T20688.hs b/testsuite/tests/quotes/T20688.hs
new file mode 100644
index 0000000000..53d859c4e8
--- /dev/null
+++ b/testsuite/tests/quotes/T20688.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE DeriveLift #-}
+module T20688 where
+
+import Language.Haskell.TH.Syntax
+
+data Foo = Foo Int Bool
+ deriving (Lift, Show)
diff --git a/testsuite/tests/quotes/all.T b/testsuite/tests/quotes/all.T
index 68a13ca5ab..e441811111 100644
--- a/testsuite/tests/quotes/all.T
+++ b/testsuite/tests/quotes/all.T
@@ -38,3 +38,4 @@ test('TH_nested_splice', normal, compile, [''])
test('TH_top_splice', normal, compile_fail, [''])
test('TTH_top_splice', normal, compile_fail, [''])
test('TH_double_splice', normal, compile_fail, [''])
+test('T20688', normal, compile, ['-Wimplicit-lift -Werror'])