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)
committerBen Gamari <ben@smart-cactus.org>
Sun, 19 Aug 2018 12:32:10 +0000 (08:32 -0400)
commitfb8b2cb11023dd453b22ba49b7535b6ae8a8b506
tree27d148be5691974d7f345cfb2c7bfa558c9bcc8b
parent13105a1ae870da6936a27cdd1d6a4bd25a661368
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

(cherry picked from commit 5238f204482ac7f05f4e2d2e92576288cc00d42d)
compiler/hsSyn/HsExpr.hs
docs/users_guide/8.6.1-notes.rst
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