summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2018-07-05 08:50:56 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2018-07-05 09:51:15 -0400
commit57733978482dc1e566a7d4cd90d4cbbd1315e3b2 (patch)
treeb0d8cc06140c6eaa87abdfa4165a5a2ee7c48c51
parent927518668111584a06f12bd9eb1b0910a38acf4f (diff)
downloadhaskell-57733978482dc1e566a7d4cd90d4cbbd1315e3b2.tar.gz
Parenthesize rank-n contexts in Convert
Summary: A simple oversight. Test Plan: make test TEST=T15324 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15324 Differential Revision: https://phabricator.haskell.org/D4910
-rw-r--r--compiler/hsSyn/Convert.hs4
-rw-r--r--testsuite/tests/th/T15324.hs7
-rw-r--r--testsuite/tests/th/T15324.stderr6
-rw-r--r--testsuite/tests/th/all.T1
4 files changed, 17 insertions, 1 deletions
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs
index 329d000e29..aa651da8e3 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -1283,7 +1283,9 @@ cvtTypeKind ty_str ty
x'' <- case x' of
L _ HsFunTy{} -> returnL (HsParTy noExt x')
L _ HsForAllTy{} -> returnL (HsParTy noExt x')
- -- #14646
+ -- #14646
+ L _ HsQualTy{} -> returnL (HsParTy noExt x')
+ -- #15324
_ -> return x'
returnL (HsFunTy noExt x'' y')
| otherwise ->
diff --git a/testsuite/tests/th/T15324.hs b/testsuite/tests/th/T15324.hs
new file mode 100644
index 0000000000..ea124f4dc7
--- /dev/null
+++ b/testsuite/tests/th/T15324.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TemplateHaskell #-}
+module T15324 where
+
+$([d| f :: forall a. (Show a => a) -> a
+ f _ = undefined
+ |])
diff --git a/testsuite/tests/th/T15324.stderr b/testsuite/tests/th/T15324.stderr
new file mode 100644
index 0000000000..49db9ed8d9
--- /dev/null
+++ b/testsuite/tests/th/T15324.stderr
@@ -0,0 +1,6 @@
+T15324.hs:(5,3)-(7,6): Splicing declarations
+ [d| f :: forall a. (Show a => a) -> a
+ f _ = undefined |]
+ ======>
+ f :: forall a. (Show a => a) -> a
+ f _ = undefined
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index f95e8f4037..d8b8c94f9f 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -416,3 +416,4 @@ test('T14885b', normal, compile, [''])
test('T14885c', normal, compile, [''])
test('T15243', normal, compile, ['-dsuppress-uniques'])
test('T15321', normal, compile_fail, [''])
+test('T15324', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])