Parenthesize rank-n contexts in Convert
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 5 Jul 2018 12:50:56 +0000 (08:50 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 5 Jul 2018 13:51:15 +0000 (09:51 -0400)
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

compiler/hsSyn/Convert.hs
testsuite/tests/th/T15324.hs [new file with mode: 0644]
testsuite/tests/th/T15324.stderr [new file with mode: 0644]
testsuite/tests/th/all.T

index 329d000..aa651da 100644 (file)
@@ -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 (file)
index 0000000..ea124f4
--- /dev/null
@@ -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 (file)
index 0000000..49db9ed
--- /dev/null
@@ -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
index f95e8f4..d8b8c94 100644 (file)
@@ -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'])