Fix `:k` command: add validity checking
ClosedPublic

Authored by ningning on Oct 26 2018, 3:34 AM.

Details

Summary

This patch fixes Trac #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

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ningning created this revision.Oct 26 2018, 3:34 AM
bgamari accepted this revision.Oct 28 2018, 11:04 AM

Looks reasonable to me. One question inline.

compiler/typecheck/TcRnDriver.hs
2396

While researching this I found a comment in hscKcType suggesting that kinds are not generalized. However, the above comment appears to contradict that. Which is correct?

This revision is now accepted and ready to land.Oct 28 2018, 11:04 AM
This revision was automatically updated to reflect the committed changes.
goldfire added inline comments.Oct 28 2018, 10:07 PM
compiler/typecheck/TcRnDriver.hs
2396

Indeed, we shouldn't generalize. I'm fixing this.