diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-05 08:29:59 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-05 08:29:59 -0400 |
commit | 59a15a56e180b59656e45df04f7df61de8298881 (patch) | |
tree | 857ac6a5d459281ac567a5b9b34e61fcbdf4b7d9 /testsuite/tests/deriving | |
parent | 45f44e2c9d5db2f25c52abb402f197c20579400f (diff) | |
download | haskell-59a15a56e180b59656e45df04f7df61de8298881.tar.gz |
Fix #15307 by making nlHsFunTy parenthesize more
Summary:
`nlHsFunTy` wasn't parenthesizing its arguments at all,
which led to `-ddump-deriv` producing incorrectly parenthesized
types (since it uses `nlHsFunTy` to construct those types), as
demonstrated in #15307. Fix this by changing `nlHsFunTy` to add
parentheses à la `ppr_ty`: always parenthesizing the argument type
with function precedence, and recursively processing the result type,
adding parentheses for each function type it encounters.
Test Plan: make test TEST=T14578
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15307
Differential Revision: https://phabricator.haskell.org/D4890
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14578.stderr | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14578.stderr b/testsuite/tests/deriving/should_compile/T14578.stderr index bdb6ca5296..acbbdd627b 100644 --- a/testsuite/tests/deriving/should_compile/T14578.stderr +++ b/testsuite/tests/deriving/should_compile/T14578.stderr @@ -7,10 +7,10 @@ Derived class instances: = GHC.Prim.coerce @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep). - a -> b -> f a -> f b) + (a -> b) -> f a -> f b) @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep). - a -> b -> T14578.App f a -> T14578.App f b) + (a -> b) -> T14578.App f a -> T14578.App f b) GHC.Base.fmap (GHC.Base.<$) = GHC.Prim.coerce @@ -43,11 +43,12 @@ Derived class instances: @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep) (c :: TYPE GHC.Types.LiftedRep). - a -> b -> c -> f a -> f b -> f c) + (a -> b -> c) -> f a -> f b -> f c) @(forall (a :: TYPE GHC.Types.LiftedRep) (b :: TYPE GHC.Types.LiftedRep) (c :: TYPE GHC.Types.LiftedRep). - a -> b -> c -> T14578.App f a -> T14578.App f b -> T14578.App f c) + (a -> b -> c) + -> T14578.App f a -> T14578.App f b -> T14578.App f c) GHC.Base.liftA2 (GHC.Base.*>) = GHC.Prim.coerce |