diff options
-rw-r--r-- | compiler/hsSyn/Convert.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/th/T15815A.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/th/T15815B.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 2 |
4 files changed, 22 insertions, 1 deletions
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index 8b12a78ed3..06d5d6ca7a 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -1437,7 +1437,13 @@ cvtTypeKind ty_str ty EqualityT | [x',y'] <- tys' -> - returnL (HsOpTy noExt x' (noLoc eqTyCon_RDR) y') + let px = parenthesizeHsType opPrec x' + py = parenthesizeHsType opPrec y' + in returnL (HsOpTy noExt px (noLoc eqTyCon_RDR) py) + -- The long-term goal is to remove the above case entirely and + -- subsume it under the case for InfixT. See #15815, comment:6, + -- for more details. + | otherwise -> mk_apps (HsTyVar noExt NotPromoted (noLoc eqTyCon_RDR)) tys' diff --git a/testsuite/tests/th/T15815A.hs b/testsuite/tests/th/T15815A.hs new file mode 100644 index 0000000000..4025f3856c --- /dev/null +++ b/testsuite/tests/th/T15815A.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} +module T15815A where + +mkFoo tyQ = [d| + foo :: a ~ $(tyQ) => a + foo = undefined + |] diff --git a/testsuite/tests/th/T15815B.hs b/testsuite/tests/th/T15815B.hs new file mode 100644 index 0000000000..32bf2edfd5 --- /dev/null +++ b/testsuite/tests/th/T15815B.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TemplateHaskell, GADTs #-} +module T15815B where + +import T15815A + +mkFoo [t| Int -> Int |] diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 50154a4fea..2481a2ab12 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -446,3 +446,5 @@ test('T15738', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T15783', normal, multimod_compile, ['T15783A', '-v0 ' + config.ghc_th_way_flags]) test('T15792', normal, compile, ['-v0 -dsuppress-uniques']) +test('T15815', normal, multimod_compile, + ['T15815B', '-v0 ' + config.ghc_th_way_flags]) |