[commit: ghc] master: Use IfaceAppArgs to store an IfaceAppTy's arguments (1c35362)
git at git.haskell.org
git at git.haskell.org
Wed Jul 11 16:31:42 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1c3536239cb5e83ff1427ac410d8fa2549e7d9c0/ghc
>---------------------------------------------------------------
commit 1c3536239cb5e83ff1427ac410d8fa2549e7d9c0
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Wed Jul 11 12:28:38 2018 -0400
Use IfaceAppArgs to store an IfaceAppTy's arguments
Summary:
Currently, an `IfaceAppTy` has no way to tell whether its
argument is visible or not, so it simply treats all arguments as
visible, leading to #15330. We already have a solution for this
problem in the form of the `IfaceTcArgs` data structure, used by
`IfaceTyConApp` to represent the arguments to a type constructor.
Therefore, it makes sense to reuse this machinery for `IfaceAppTy`,
so this patch does just that.
This patch:
1. Renames `IfaceTcArgs` to `IfaceAppArgs` to reflect its more
general purpose.
2. Changes the second field of `IfaceAppTy` from `IfaceType` to
`IfaceAppArgs`, and propagates the necessary changes through. In
particular, pretty-printing an `IfaceAppTy` now goes through the
`IfaceAppArgs` pretty-printer, which correctly displays arguments
as visible or not for free, fixing #15330.
3. Changes `toIfaceTypeX` and related functions so that when
converting an `AppTy` to an `IfaceAppTy`, it flattens as many
argument `AppTy`s as possible, and then converts those arguments
into an `IfaceAppArgs` list, using the kind of the function
`Type` as a guide. (Doing so minimizes the number of times we need
to call `typeKind`, which is more expensive that finding the kind
of a `TyCon`.)
Test Plan: make test TEST=T15330
Reviewers: goldfire, simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15330
Differential Revision: https://phabricator.haskell.org/D4938
>---------------------------------------------------------------
1c3536239cb5e83ff1427ac410d8fa2549e7d9c0
compiler/backpack/RnModIface.hs | 18 +-
compiler/iface/IfaceSyn.hs | 26 +-
compiler/iface/IfaceType.hs | 297 +++++++++++++--------
compiler/iface/IfaceType.hs-boot | 4 +-
compiler/iface/TcIface.hs | 21 +-
compiler/iface/ToIface.hs | 37 ++-
compiler/iface/ToIface.hs-boot | 4 +-
compiler/types/TyCoRep.hs | 3 +
.../tests/indexed-types/should_fail/T14369.stderr | 6 +-
.../tests/partial-sigs/should_fail/T14040a.stderr | 9 +-
.../tests/typecheck/should_fail/T14350.stderr | 23 +-
testsuite/tests/typecheck/should_fail/T15330.hs | 15 ++
.../tests/typecheck/should_fail/T15330.stderr | 14 +
testsuite/tests/typecheck/should_fail/all.T | 1 +
14 files changed, 296 insertions(+), 182 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1c3536239cb5e83ff1427ac410d8fa2549e7d9c0
More information about the ghc-commits
mailing list