From c2455e647501c5a382861196b64df3dd05b620a2 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Wed, 9 Jan 2019 14:52:30 +0000 Subject: 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 --- testsuite/tests/th/T15471.hs | 11 +++++++++++ testsuite/tests/th/T15471A.hs | 14 ++++++++++++++ testsuite/tests/th/all.T | 1 + 3 files changed, 26 insertions(+) create mode 100644 testsuite/tests/th/T15471.hs create mode 100644 testsuite/tests/th/T15471A.hs (limited to 'testsuite/tests/th') 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']) -- cgit v1.2.1