diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-26 12:31:59 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-26 12:31:59 -0500 |
commit | ad3d2dfa19a1ed788c682e8b0c7c6e66e63d3f79 (patch) | |
tree | 9eafc6cc161103e28256b4353994eb052fb85c4e /testsuite/tests/th/T7532.stderr | |
parent | 50544eea6ba519ce225e8bd01265e5a4a5d04bef (diff) | |
download | haskell-ad3d2dfa19a1ed788c682e8b0c7c6e66e63d3f79.tar.gz |
Don't unnecessarily qualify TH-converted instances with empty contexts
Summary:
The addition of rigorous pretty-printer tests
(499e43824bda967546ebf95ee33ec1f84a114a7c) had the unfortunate
side-effect of revealing a bug in `hsSyn/Convert.hs` wherein instances are
_always_ qualified with an instance context, even if the context is empty. This
led to instances like this:
```
instance Foo Int
```
being pretty-printed like this!
```
instance () => Foo Int
```
We can prevent this by checking if the context is empty before adding an
HsQualTy to the type.
Also does some refactoring around HsForAllTys in `Convert` while I was in town.
Fixes #13183.
Test Plan: ./validate
Reviewers: goldfire, bgamari, austin, alanz
Reviewed By: alanz
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D3018
GHC Trac Issues: #13183
Diffstat (limited to 'testsuite/tests/th/T7532.stderr')
-rw-r--r-- | testsuite/tests/th/T7532.stderr | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testsuite/tests/th/T7532.stderr b/testsuite/tests/th/T7532.stderr index 21b753b5d3..baaf04f3f5 100644 --- a/testsuite/tests/th/T7532.stderr +++ b/testsuite/tests/th/T7532.stderr @@ -6,10 +6,10 @@ instance C Bool where T7532.hs:11:3-7: Splicing declarations bang' ======> - instance () => C Int where + instance C Int where data D Int = T ==================== Renamer ==================== -instance () => C Int where +instance C Int where data D Int = T7532.T |