diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2017-10-02 18:09:37 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2017-10-02 20:15:11 +0200 |
commit | 0e9681268a38cbc15c9c2b50979624732c9077ce (patch) | |
tree | c5e3531324db10244e79bfd57e4255876df422de /compiler/hsSyn/HsDecls.hs | |
parent | 11a59de25d49f999eed0ea55df29d916a66ecd91 (diff) | |
download | haskell-0e9681268a38cbc15c9c2b50979624732c9077ce.tar.gz |
Pretty-printer missing parens for infix class declaration
class (a `C` b) c
Is pretty printed as
class a `C` b c
Fixes #14306
Diffstat (limited to 'compiler/hsSyn/HsDecls.hs')
-rw-r--r-- | compiler/hsSyn/HsDecls.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/hsSyn/HsDecls.hs b/compiler/hsSyn/HsDecls.hs index ecb11a08d6..35fccd3396 100644 --- a/compiler/hsSyn/HsDecls.hs +++ b/compiler/hsSyn/HsDecls.hs @@ -695,6 +695,10 @@ pp_vanilla_decl_head thing (HsQTvs { hsq_explicit = tyvars }) fixity context = hsep [pprHsContext context, pp_tyvars tyvars] where pp_tyvars (varl:varsr) + | fixity == Infix && length varsr > 1 + = hsep [char '(',ppr (unLoc varl), pprInfixOcc (unLoc thing) + , (ppr.unLoc) (head varsr), char ')' + , hsep (map (ppr.unLoc) (tail varsr))] | fixity == Infix = hsep [ppr (unLoc varl), pprInfixOcc (unLoc thing) , hsep (map (ppr.unLoc) varsr)] |