Fix `:k` command: add validity checking
authorNingning Xie <xnningxie@gmail.com>
Sun, 28 Oct 2018 16:26:12 +0000 (12:26 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 28 Oct 2018 17:40:13 +0000 (13:40 -0400)
commitc4a876d5f99554e87400946dd26ca11819d11673
treeb22e6f689a886c02682af21653aa045e17c6b0d8
parent134de45117bdbb031f513734b84403443e083fbe
Fix `:k` command: add validity checking

Summary:
This patch fixes #15806, where we found that the `:k` command in GHCi
misses a validity checking for the type.

Missing validity checking causes `:k` to accept types that are not validated.
For example, `:k (Maybe (forall a. a -> a))` (incorrectly) returns `*`, while
impredictivity of type instantiation shouldn't be allowed.

Test Plan: ./validate

Reviewers: simonpj, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15806

Differential Revision: https://phabricator.haskell.org/D5265
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcRnDriver.hs
testsuite/tests/ghci/should_run/T15806.script [new file with mode: 0644]
testsuite/tests/ghci/should_run/T15806.stderr [new file with mode: 0644]
testsuite/tests/ghci/should_run/T15806.stdout [new file with mode: 0644]
testsuite/tests/ghci/should_run/all.T