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/T5883.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/T5883.stderr')
-rw-r--r-- | testsuite/tests/th/T5883.stderr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/testsuite/tests/th/T5883.stderr b/testsuite/tests/th/T5883.stderr index b63ea2f38c..aa87a41052 100644 --- a/testsuite/tests/th/T5883.stderr +++ b/testsuite/tests/th/T5883.stderr @@ -6,6 +6,6 @@ T5883.hs:(7,4)-(12,4): Splicing declarations {-# INLINE show #-} |] ======> data Unit = Unit - instance () => Show Unit where + instance Show Unit where {-# INLINE show #-} show _ = "" |