Fix #15792 by not reifying invisible arguments in AppTys
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 24 Oct 2018 11:03:40 +0000 (07:03 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Wed, 24 Oct 2018 11:05:40 +0000 (07:05 -0400)
commitbfd93f90b6c63edf2790356e95feddf9898ec888
tree30d1f1bffd37b27202f52a57d604f0eee6425531
parentbb835c96c3d962c2e08d23f6fb900665c89953b4
Fix #15792 by not reifying invisible arguments in AppTys

Summary:
The `reifyType` function in `TcSplice` is carefully designed
to avoid reifying visible arguments to `TyConApp`s. However, the same
care was not given towards the `AppTy` case, which lead to #15792.

This patch changes to the `AppTy` case of `reifyType` so that it
consults the kind of the function type to determine which of the
argument types are invisible (and therefore should be dropped) during
reification. This required crafting a variant of `tyConArgFlags`,
which I dubbed `appTyArgFlags`, that accept an arbitrary function
`Type` instead of a `TyCon`.

Test Plan: make test TEST=T15792

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #15792

Differential Revision: https://phabricator.haskell.org/D5252
compiler/typecheck/TcSplice.hs
compiler/types/Type.hs
testsuite/tests/th/T15792.hs [new file with mode: 0644]
testsuite/tests/th/T15792.stderr [new file with mode: 0644]
testsuite/tests/th/all.T