summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-01-09 14:52:30 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2019-01-11 03:45:33 -0500
commitc2455e647501c5a382861196b64df3dd05b620a2 (patch)
tree60b56e73488fc237acf76d3f40e782830a6ecf56 /testsuite/tests
parent82d1a88dec216d761b17252ede760da5c566007f (diff)
downloadhaskell-c2455e647501c5a382861196b64df3dd05b620a2.tar.gz
Run typed splices in the zonker
Summary: This fixes #15471 In the typechecker we check that the splice has the right type but we crucially don't zonk the generated expression. This is because we might end up unifying type variables from outer scopes later on. Reviewers: simonpj, goldfire, bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15471 Differential Revision: https://phabricator.haskell.org/D5286
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/th/T15471.hs11
-rw-r--r--testsuite/tests/th/T15471A.hs14
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/th/T15471.hs b/testsuite/tests/th/T15471.hs
new file mode 100644
index 0000000000..0f0abdf461
--- /dev/null
+++ b/testsuite/tests/th/T15471.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T15471 where
+
+import T15471A
+
+
+qux = $$(test_foo)
+
+bar y = $$(list_foo [|| y ||] )
+
+main = print (qux 5) >> print (bar True)
diff --git a/testsuite/tests/th/T15471A.hs b/testsuite/tests/th/T15471A.hs
new file mode 100644
index 0000000000..2bf5cc8952
--- /dev/null
+++ b/testsuite/tests/th/T15471A.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T15471A where
+
+import Language.Haskell.TH
+
+foo1 x = x
+
+
+test_foo :: Q (TExp (a -> a))
+test_foo = [|| foo1 ||]
+
+
+list_foo :: Q (TExp a) -> Q (TExp [a])
+list_foo x = [|| [ $$x, $$x ] ||]
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 48b768127e..6783bb6c78 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -466,3 +466,4 @@ test('T15437', expect_broken(15437), multimod_compile,
['T15437', '-v0 ' + config.ghc_th_way_flags])
test('T15985', normal, compile, [''])
test('T16133', normal, compile_fail, [''])
+test('T15471', normal, multimod_compile, ['T15471.hs', '-v0'])