Prevent Template Haskell splices from throwing a spurious TypeInType error
authorRyan Scott <ryan.gl.scott@gmail.com>
Fri, 10 Feb 2017 15:31:10 +0000 (10:31 -0500)
committerRyan Scott <ryan.gl.scott@gmail.com>
Fri, 10 Feb 2017 15:31:10 +0000 (10:31 -0500)
commit283a346586e5bf711ecd8cc61263d87771f8f744
tree8af023bc2eb9b81e11b98254be0c9cdc5b45050b
parent76244ec2cbdef8e3cd54466ae0b55ecffb81817c
Prevent Template Haskell splices from throwing a spurious TypeInType error

Summary:
There was a rather annoying corner case where splicing poly-kinded
Template Haskell declarations could trigger an error muttering about
`TypeInType` not being enabled, whereas the equivalent non-TH code would
compile without issue. This was causing by overzealous validity check in the
renamer, wherein failed to distinguish between two different `Exact` names
with the same `OccName`. As a result, it mistakenly believed some type
variables were being used as both type and kind variables simultaneously! Ack.

This avoids the issue by simply disabling the aforementioned validity check
for Exact names. Fixes #12503.

Test Plan: ./validate

Reviewers: austin, bgamari, goldfire

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D3022
compiler/rename/RnTypes.hs
testsuite/tests/th/T12503.hs [new file with mode: 0644]
testsuite/tests/th/all.T