Fix #16666 by parenthesizing contexts in Convert
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 16 May 2019 21:50:33 +0000 (17:50 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 21 May 2019 21:19:22 +0000 (17:19 -0400)
commit4a6c8436f974cafc36a6e0462878614bdc0899c0
treebc9843fd192150bfd32609f636f8484e998e33e3
parente32c30caf48517df8ddca6a79a39becfe5622c39
Fix #16666 by parenthesizing contexts in Convert

Most places where we convert contexts in `Convert` are actually in
positions that are to the left of some `=>`, such as in superclasses
and instance contexts. Accordingly, these contexts need to be
parenthesized at `funPrec`. To accomplish this, this patch changes
`cvtContext` to require a precedence argument for the purposes of
calling `parenthesizeHsContext` and adjusts all `cvtContext` call
sites accordingly.
compiler/hsSyn/Convert.hs
testsuite/tests/th/T16666.hs [new file with mode: 0644]
testsuite/tests/th/T16666.stderr [new file with mode: 0644]
testsuite/tests/th/all.T