Fix #15527 by pretty-printing an RdrName prefixly
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 16 Aug 2018 09:53:33 +0000 (11:53 +0200)
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Thu, 16 Aug 2018 09:53:34 +0000 (11:53 +0200)
commit5238f204482ac7f05f4e2d2e92576288cc00d42d
tree2759d8706459ea8f222a49a6c2330481c51e42e7
parent7a63f75353d73743d7c57bbbee701f67210a64de
Fix #15527 by pretty-printing an RdrName prefixly

Summary:
When `(.) @Int` is used without enabling `TypeApplications`,
the resulting error message will pretty-print the (symbolic)
`RdrName` `(.)`. However, it does so without parenthesizing it, which
causes the pretty-printed expression to appear as `.@Int`. Yuck.

Since the expression in a type application will always be prefix,
we can fix this issue by using `pprPrefixOcc` instead of plain ol'
`ppr`.

Test Plan: make test TEST=T15527

Reviewers: bgamari, monoidal, simonpj

Reviewed By: monoidal, simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15527

Differential Revision: https://phabricator.haskell.org/D5071
compiler/hsSyn/HsExpr.hs
testsuite/tests/typecheck/should_fail/T15527.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T15527.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T