diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2022-02-08 08:03:21 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-09 03:58:13 -0500 |
commit | fd9981e347144ce69f4747bd635789f25b673f93 (patch) | |
tree | 9cb06df130de2866bfa1ac79c2e3e7fcbaa846ee /testsuite | |
parent | 62fa126d0f04c507e622c1f0356f26c9692e2b8e (diff) | |
download | haskell-fd9981e347144ce69f4747bd635789f25b673f93.tar.gz |
Look through untyped TH splices in tcInferAppHead_maybe
Previously, surrounding a head expression with a TH splice would defeat
`tcInferAppHead_maybe`, preventing some expressions from typechecking that
used to typecheck in previous GHC versions (see #21038 for examples). This is
simple enough to fix: just look through `HsSpliceE`s in `tcInferAppHead_maybe`.
I've added some additional prose to `Note [Application chains and heads]` in
`GHC.Tc.Gen.App` to accompany this change.
Fixes #21038.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/th/T21038.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/th/T21038.hs b/testsuite/tests/th/T21038.hs new file mode 100644 index 0000000000..6c080bc86c --- /dev/null +++ b/testsuite/tests/th/T21038.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TemplateHaskell #-} +module T21038 where + +data Foo = MkFoo (forall a. a -> a) + +worksOnAllGHCs1 :: Foo +worksOnAllGHCs1 = MkFoo (\x -> x) + +worksOnAllGHCs2 :: Foo +worksOnAllGHCs2 = MkFoo $ \x -> x + +worksOnAllGHCs3 :: Foo +worksOnAllGHCs3 = $([| MkFoo |]) (\x -> x) + +doesn'tWorkOnGHC9'2'1 :: Foo +doesn'tWorkOnGHC9'2'1 = $([| MkFoo |]) $ \x -> x diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 1e9ece046a..aa953098ce 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -543,3 +543,4 @@ test('T17820e', normal, compile_fail, ['']) test('T20590', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T20773', only_ways(['ghci']), ghci_script, ['T20773.script']) test('T20884', normal, compile_fail, ['']) +test('T21038', normal, compile, ['']) |