Fix #14869 by being more mindful of Type vs. Constraint
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 21 Mar 2018 12:59:28 +0000 (08:59 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Wed, 21 Mar 2018 12:59:29 +0000 (08:59 -0400)
commit49ac3f0f2a13f66fea31a258fa98b0de39bfbf10
treebb93d071e6c8f5b0f5c1bec55b3fa567056b4f8d
parentabaf43d9d88d6fdf7345b936a571d17cfe1fa140
Fix #14869 by being more mindful of Type vs. Constraint

Summary:
Before, we were using `isLiftedTypeKind` in `reifyType`
before checking if a type was `Constraint`. But as it turns out,
`isLiftedTypeKind` treats `Constraint` the same as `Type`, so every
occurrence of `Constraint` would be reified as `Type`! To make things
worse, the documentation for `isLiftedTypeKind` stated that it
treats `Constraint` //differently// from `Type`, which simply isn't
true.

This revises the documentation for `isLiftedTypeKind` to reflect
reality, and defers the `isLiftedTypeKind` check in `reifyType` so
that it does not accidentally swallow `Constraint`.

Test Plan: make test TEST=T14869

Reviewers: goldfire, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14869

Differential Revision: https://phabricator.haskell.org/D4474
compiler/typecheck/TcSplice.hs
compiler/types/Kind.hs
compiler/types/TyCoRep.hs
testsuite/tests/th/T14869.hs [new file with mode: 0644]
testsuite/tests/th/T14869.stderr [new file with mode: 0644]
testsuite/tests/th/all.T