summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-10-07 16:59:03 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2017-10-07 16:59:03 -0400
commitf1d2db68d87f2c47a8dd4d86910e415599777f9f (patch)
treed54899b4141566fe0251eb6c685cf70e5a3fadfe /testsuite/tests/gadt
parent341d3a7896385f14580d048ea7681232e5b242ce (diff)
downloadhaskell-f1d2db68d87f2c47a8dd4d86910e415599777f9f.tar.gz
Fix #14320 by looking through HsParTy in more places
Summary: GHC was needlessly rejecting GADT constructors' type signatures that were surrounded in parentheses due to the fact that `splitLHsForAllTy` and `splitLHsQualTy` (which are used to check as part of checking if GADT constructor return types are correct) weren't looking through parentheses (i.e., `HsParTy`). This is easily fixed, though. Test Plan: make test TEST=T14320 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14320 Differential Revision: https://phabricator.haskell.org/D4072
Diffstat (limited to 'testsuite/tests/gadt')
-rw-r--r--testsuite/tests/gadt/T14320.hs15
-rw-r--r--testsuite/tests/gadt/all.T1
2 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/T14320.hs b/testsuite/tests/gadt/T14320.hs
new file mode 100644
index 0000000000..4acd4c8f63
--- /dev/null
+++ b/testsuite/tests/gadt/T14320.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE RankNTypes, GADTs, KindSignatures #-}
+module T14320
+where
+
+data Exp :: * where
+ Lit :: (Int -> Exp)
+
+newtype TypedExp :: * -> * where
+ TEGood :: forall a . (Exp -> (TypedExp a))
+
+-- The only difference here is that the type is wrapped in parentheses,
+-- but GHC 8.0.1 rejects this program
+--
+newtype TypedExpToo :: * -> * where
+ TEBad :: (forall a . (Exp -> (TypedExpToo a)))
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T
index 3c825f0848..c81ab80c04 100644
--- a/testsuite/tests/gadt/all.T
+++ b/testsuite/tests/gadt/all.T
@@ -114,3 +114,4 @@ test('T9096', normal, compile, [''])
test('T9380', normal, compile_and_run, [''])
test('T12087', normal, compile_fail, [''])
test('T12468', normal, compile_fail, [''])
+test('T14320', normal, compile, [''])