Don't reify redundant class method tyvars/contexts
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 27 Aug 2018 12:06:17 +0000 (14:06 +0200)
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Mon, 27 Aug 2018 12:06:17 +0000 (14:06 +0200)
commit6e765aebbe0a565f2476b522a49faf8edb9a93ee
tree8ddee8fff79c617bbff367808870664cae5dc853
parent744b034dc2ea5b7b82b5586a263c12f231e803f1
Don't reify redundant class method tyvars/contexts

Summary:
Currently, reifying classes produces class methods with
redundant tyvars and class contexts in their type signatures, such
as in the following:

```lang=haskell
class C a where
  method :: forall a. C a => a
```

Fixing this is very straightforward: just apply `tcSplitMethodTy` to
the type of each class method to lop off the redundant parts.

It's possible that this could break some TH code in the wild that
assumes the existence of these tyvars and class contexts, so I'll
advertise this change in the release notes just to be safe.

Test Plan: make test TEST="TH_reifyDecl1 T9064 T10891 T14888"

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #15551

Differential Revision: https://phabricator.haskell.org/D5088
compiler/typecheck/TcSplice.hs
docs/users_guide/8.8.1-notes.rst
testsuite/tests/th/T10891.stderr
testsuite/tests/th/T14888.stderr
testsuite/tests/th/T9064.stderr
testsuite/tests/th/TH_reifyDecl1.stderr